PostgreSQLでデータベース一覧を表示する方法
PostgreSQLをコマンドラインで使用した場合のデータベース一覧を表示する方法を以下にメモとして記載する。
psql -U postgresでログイン
\l
※Windowsの場合は「¥l」となる。「¥」は半角。
※Linuxの場合は「¥」はバックスラッシュで表示される。
postgres=# \l
※「l」は、半角アルファベットのl(エル)。
List of databases
Name | Owner | Encoding
----------------------+----------+----------
neko1_db | postgres | EUC_JP
neko2_db | postgres | EUC_JP
neko3_db | postgres | EUC_JP
postgres | postgres | EUC_JP
template0 | postgres | EUC_JP
template1 | postgres | EUC_JP
(6 rows)
データベース一覧の他、データベースの所有者(Owner)エンコーディング(Encoding)も確認できる。