I have created a graph called ‘cyc_graph’, Now I’m testing to see if I can insert some vertices in this graph using the agtype_build_map function, but this function requires graphID as a parameter. So How can I get the graphID of a graph already created from PostgreSQL terminal?
I tried something like this
SELECT 'cyc_graph.vtxs'::regclass::oid;
But this gives Oid of vtxs table. (vtxs is label name for vertices). I understand that cyc_graph is a schema name. So I don’t know how can I get graphID/Oid of a schema name.
2
Answers
From Reference: https://age.apache.org/age-manual/master/intro/types.html#graphid:
Here the id is actually GraphID.
Inside the terminal, after loading AGE extension and setting search_path, use the command:
It will output something like this:
The column
oid
is the Oid of the graphs.But maybe you want to do it from the source code?
Call the function
search_graph_name_cache(char* graph_name);
(located here)
It will return a pointer to a struct defined as
graph_cache_data
, which has the Oid of the graph.