From my understanding labels in apacheAGE are stored under the schema ag_labels, and also are separate tables that the vertices and edges are stored. Also every database object inside postgres is holding an oid. What is a way to see the oid's of the different label relations inside a graph, or in general?
You can run the following query to find the OID of labels table
SELECT relname AS label_name, oid FROM pg_class WHERE relname = '<enter_label_name_here>';
But there may be a situation where more than one graph can have the same labels. In that case, the above query returns multiple OIDs and we can not differentiate which OID belongs to which graph's label. So, you need to join pg_class
and pg_namespace
in order to add a check for which graph you need to return the label's OID.
SELECT nsp.nspname AS graph_name, tbl.relname AS label_name,
tbl.oid AS oid
FROM pg_namespace nsp
JOIN pg_class tbl ON nsp.oid = tbl.relnamespace
WHERE nsp.nspname = '<enter_graph_name_here>' AND tbl.relname = '<enter_label_name_here>';
Above you can replace tbl.relname = '_ag_label_vertex'
or tbl.relname = '_ag_label_edge'
to get the OID of vertices or edges table.