skip to Main Content

I’m currently working on an Apache-age graph and need to retrieve the OID values for the label relations in the graph. I’m using Postgres to manage my database and have tried querying the ag_labels schema, but it doesn’t seem to contain the OID values for the label relations.

Here’s the code I’ve tried so far:

SELECT oid, relname FROM pg_class WHERE relkind = 'r' AND relname LIKE 'ag_labels_%';

This query returns the relname values for all label relations in my graph, but not the OID values.

I’ve also tried querying the pg_catalog.pg_class table directly, but this doesn’t seem to return the OID values for the label relations either.

I’m wondering if there’s another table or schema I should be looking at to retrieve the OID values for label relations in Apache-age. Any suggestions or insights would be greatly appreciated.

Thanks in advance!

2

Answers


  1. I dont think there is a single query you can run to see all the oids of the existing labels. The labels are stored in the ag.label table but that doesn’t hold information about the OID. What you could try is first querying for all the labels with

    SELECT * FROM ag_label;

    and then run

    SELECT oid, relname FROM pg_class WHERE relkind = 'r';

    and in the returned rows find the names and oids of the labels you are looking for.

    Login or Signup to reply.
  2. If you run the query:

    SELECT oid, relname FROM pg_class WHERE relkind = 'r';
    

    It will return oids as well like this:

    postgres=# SELECT oid, relname FROM pg_class WHERE relkind = 'r';
      oid  |         relname         
    -------+-------------------------
      2619 | pg_statistic
      1247 | pg_type
     27575 | _ag_label_vertex
     27585 | _ag_label_edge
     35178 | ag_graph
     35190 | ag_label
      3118 | pg_foreign_table
     35771 | _ag_label_vertex
      1260 | pg_authid
     35791 | Person
     35781 | _ag_label_edge
     35800 | RELTYPE
      3429 | pg_statistic_ext_data
      1418 | pg_user_mapping
      6100 | pg_subscription
    

    The other condition "relname LIKE ‘ag_labels_%’" might be the reason you are not getting the desired results.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search