skip to Main Content

For example in a PostgreSQL database, all the other tables can be seen using

dt

Or with

SELECT * FROM pg_catalog.pg_tables;

And we know that AGE creates its own label tables, vertex table, edge table.

How can I see those tables, and how can I query for them to view them along with their all columns?

2

Answers


  1. SELECT table_name, column_name
    FROM information_schema.columns
    ORDER BY table_name, ordinal_position;
    

    Try the above query. It should be able to give you the table and the respective columns. If it doesn’t work you can always check the documentation provided by AGE to see what you’re trying to work on. By my guess you want to retrieve the tables that are created by AGE itself therefore I think this query should be optimal.

    Login or Signup to reply.
  2. You can use the following query:

    SELECT * FROM ag_label;
    

    to get a similar result in AGE, for example:

           name       | graph | id | kind |           relation           |        seq_name
    ------------------+-------+----+------+------------------------------+-------------------------
     _ag_label_vertex | 16944 |  1 | v    | "Demo"._ag_label_vertex      | _ag_label_vertex_id_seq
     _ag_label_edge   | 16944 |  2 | e    | "Demo"._ag_label_edge        | _ag_label_edge_id_seq
     Person           | 16944 |  3 | v    | "Demo"."Person"              | Person_id_seq
     REL              | 16944 |  4 | e    | "Demo"."REL"                 | REL_id_seq
     KNOWS            | 16944 |  5 | e    | "Demo"."KNOWS"               | KNOWS_id_seq
    

    where the kind column tells you if it is a vertex v or an edge e, with their labels shown in the name column.

    Here is a regress test to check the different variations of the function.

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