久しぶりにPostgreSQLを触って、データベース一覧を表示しようと思ったら、以下のようにエラーになりました。
MySQLとコマンドが違うので、「show databases」と叩くと、「ERROR: unrecognized configuration parameter “databases”」とエラーになります。
-bash-4.2$ psql psql (9.2.24) Type "help" for help. postgres=# show databases; ERROR: unrecognized configuration parameter "databases" postgres=# \| Invalid command \|. Try \? for help.
PostgreSQLでは「\l」で表示されます。「\l」の l は、小文字のLの文字です。
WEBで見たサイトのフォントによりますが、見た感じでは、|(パイプ)と間違いました
postgres=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+----------+----------+-------------+-------------+-----------------------
testshop | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
(4 rows)
# 小文字のLですので、パイプ文字だとエラーになります
postgres=# \|
Invalid command \|. Try \? for help.
postgres=# \l



コメント