「PostgreSQL」テーブル一覧を確認する方法

2021年9月6日

1.テーブルを確認

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
postgres=# \dt
リレーションの一覧
スキーマ | 名前 || 所有者
----------+------+----------+----------
public | empp | テーブル | postgres
(1)
postgres=# \dt リレーションの一覧 スキーマ | 名前 | 型 | 所有者 ----------+------+----------+---------- public | empp | テーブル | postgres (1 行)
postgres=# \dt
          リレーションの一覧
 スキーマ | 名前 |    型    |  所有者
----------+------+----------+----------
 public   | empp | テーブル | postgres
(1 行)

2.システムカタログpg_tablesを確認

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
postgres=# select schemaname,tablename,tableowner from pg_tables;
schemaname | tablename | tableowner
--------------------+-------------------------+------------
cfschema | usetbl | postgres
public | empp | postgres
postgres=# select schemaname,tablename,tableowner from pg_tables; schemaname | tablename | tableowner --------------------+-------------------------+------------ cfschema | usetbl | postgres public | empp | postgres
postgres=# select schemaname,tablename,tableowner from pg_tables;
     schemaname     |        tablename        | tableowner
--------------------+-------------------------+------------
 cfschema           | usetbl                  | postgres
 public             | empp                    | postgres

 

PostgreSQL

Posted by arkgame