select relname,oid from pg_class
where relname not like 'pg_%'
and relname not like 'sql_%'
and relkind='r';
While creating a java bulletin board, I wanted to get the creation date and time of the created table. However, it didn't seem to be easy to obtain, so I searched for another method. As a result, pg_class I decided to use a table in the DB and a table that manages the meta information of the index. As a result, the value unique to each table could be obtained.
Reference site https://www.postgresql.jp/document/9.4/html/catalog-pg-class.html
・ Rellname: The name of the table -Oid: A table-specific value. Not duplicate. -Relkind: Table is r, index is i, sequence is s, and so on.
Using these, I succeeded in extracting only the table-specific values I created and their names.
Recommended Posts