Search code examples
postgresqlapache-age

Retrieving OID values for label relations in Apache-age graph using Postgres


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!


Solution

  • 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.