PostgreSQL/データベース一覧を調べる方法
の編集
Top
/
PostgreSQL
/
データベース一覧を調べる方法
[
トップ
] [
編集
|
差分
|
バックアップ
|
添付
|
リロード
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
]
-- 雛形とするページ --
PostgreSQL/template0とtemplate1の違いについて
#navi(../) * PostgreSQLでデータベース一覧を調べる方法 [#y60c2340] PostgreSQLのデータベース一覧を表示する方法を以下に記します。 #contents #htmlinsertpcsp(db-top.html,db-sp.html) * 関連記事 [#g7ecb697] -[[PostgreSQLのロケール設定の確認方法とロケール設定方法>PostgreSQL/ロケール設定の確認方法とロケール設定方法]] * psqlコマンドでデータベース一覧を表示する [#g9e5a676] 以下のコマンドでデータベース一覧をコマンドライン上で表示することができます。 psql -l ホスト名やポート番号を指定する場合は以下のようになります。 psql -l -p ポート番号 -h ホスト名 ** 実行例 [#n34c36cd] $ psql -l データベース一覧 名前 | 所有者 | エンコーディング | 照合順序 | Ctype(変換演算子) | アクセス権 -----------+----------+------------------+-------------+-------------------+----------------------- foo | postgres | UTF8 | ja_JP.UTF-8 | ja_JP.UTF-8 | postgres | postgres | UTF8 | ja_JP.UTF-8 | ja_JP.UTF-8 | template0 | postgres | UTF8 | ja_JP.UTF-8 | ja_JP.UTF-8 | =c/postgres : postgres=CTc/postgres template1 | postgres | UTF8 | ja_JP.UTF-8 | ja_JP.UTF-8 | =c/postgres : postgres=CTc/postgres (4 行) * psqlのプロンプト上でデータベース一覧を表示する [#ffbef4bb] psqlのプロンプト上でデーターベース一覧を表示する場合は、以下のコマンドを実行します。 ** バックスラッシュからはじまるコマンドでデータベース一覧を表示 [#ie943aa1] \l *** 実行例 [#rba67cad] $ psql postgres psql (8.4.13) "help" でヘルプを表示します. postgres=# \l データベース一覧 名前 | 所有者 | エンコーディング | 照合順序 | Ctype(変換演算子) | アクセス権 -----------+----------+------------------+-------------+-------------------+----------------------- foo | postgres | UTF8 | ja_JP.UTF-8 | ja_JP.UTF-8 | postgres | postgres | UTF8 | ja_JP.UTF-8 | ja_JP.UTF-8 | template0 | postgres | UTF8 | ja_JP.UTF-8 | ja_JP.UTF-8 | =c/postgres : postgres=CTc/postgres template1 | postgres | UTF8 | ja_JP.UTF-8 | ja_JP.UTF-8 | =c/postgres : postgres=CTc/postgres (4 行) ** SQLでデータベース一覧を確認する方法 [#t2d0b779] 以下のSQLでもデータベース一覧を表示することができます。 SELECT * FROM pg_database; *** 実行例 [#of96fc33] postgres=# SELECT * FROM pg_database; datname | datdba | encoding | datcollate | datctype | datistemplate | datallowconn | datconnlimit | datlastsysoid | datfrozenxid | dattablespace | datco nfig | datacl -----------+--------+----------+-------------+-------------+---------------+--------------+--------------+---------------+--------------+---------------+------ -----+------------------------------------- template1 | 10 | 6 | ja_JP.UTF-8 | ja_JP.UTF-8 | t | t | -1 | 11563 | 648 | 1663 | | {=c/postgres,postgres=CTc/postgres} template0 | 10 | 6 | ja_JP.UTF-8 | ja_JP.UTF-8 | t | f | -1 | 11563 | 648 | 1663 | | {=c/postgres,postgres=CTc/postgres} postgres | 10 | 6 | ja_JP.UTF-8 | ja_JP.UTF-8 | f | t | -1 | 11563 | 648 | 1663 | | foo | 10 | 6 | ja_JP.UTF-8 | ja_JP.UTF-8 | f | t | -1 | 11563 | 648 | 1663 | | (4 行) #htmlinsertpcsp(db-btm.html,db-sp.html)
タイムスタンプを変更しない
#navi(../) * PostgreSQLでデータベース一覧を調べる方法 [#y60c2340] PostgreSQLのデータベース一覧を表示する方法を以下に記します。 #contents #htmlinsertpcsp(db-top.html,db-sp.html) * 関連記事 [#g7ecb697] -[[PostgreSQLのロケール設定の確認方法とロケール設定方法>PostgreSQL/ロケール設定の確認方法とロケール設定方法]] * psqlコマンドでデータベース一覧を表示する [#g9e5a676] 以下のコマンドでデータベース一覧をコマンドライン上で表示することができます。 psql -l ホスト名やポート番号を指定する場合は以下のようになります。 psql -l -p ポート番号 -h ホスト名 ** 実行例 [#n34c36cd] $ psql -l データベース一覧 名前 | 所有者 | エンコーディング | 照合順序 | Ctype(変換演算子) | アクセス権 -----------+----------+------------------+-------------+-------------------+----------------------- foo | postgres | UTF8 | ja_JP.UTF-8 | ja_JP.UTF-8 | postgres | postgres | UTF8 | ja_JP.UTF-8 | ja_JP.UTF-8 | template0 | postgres | UTF8 | ja_JP.UTF-8 | ja_JP.UTF-8 | =c/postgres : postgres=CTc/postgres template1 | postgres | UTF8 | ja_JP.UTF-8 | ja_JP.UTF-8 | =c/postgres : postgres=CTc/postgres (4 行) * psqlのプロンプト上でデータベース一覧を表示する [#ffbef4bb] psqlのプロンプト上でデーターベース一覧を表示する場合は、以下のコマンドを実行します。 ** バックスラッシュからはじまるコマンドでデータベース一覧を表示 [#ie943aa1] \l *** 実行例 [#rba67cad] $ psql postgres psql (8.4.13) "help" でヘルプを表示します. postgres=# \l データベース一覧 名前 | 所有者 | エンコーディング | 照合順序 | Ctype(変換演算子) | アクセス権 -----------+----------+------------------+-------------+-------------------+----------------------- foo | postgres | UTF8 | ja_JP.UTF-8 | ja_JP.UTF-8 | postgres | postgres | UTF8 | ja_JP.UTF-8 | ja_JP.UTF-8 | template0 | postgres | UTF8 | ja_JP.UTF-8 | ja_JP.UTF-8 | =c/postgres : postgres=CTc/postgres template1 | postgres | UTF8 | ja_JP.UTF-8 | ja_JP.UTF-8 | =c/postgres : postgres=CTc/postgres (4 行) ** SQLでデータベース一覧を確認する方法 [#t2d0b779] 以下のSQLでもデータベース一覧を表示することができます。 SELECT * FROM pg_database; *** 実行例 [#of96fc33] postgres=# SELECT * FROM pg_database; datname | datdba | encoding | datcollate | datctype | datistemplate | datallowconn | datconnlimit | datlastsysoid | datfrozenxid | dattablespace | datco nfig | datacl -----------+--------+----------+-------------+-------------+---------------+--------------+--------------+---------------+--------------+---------------+------ -----+------------------------------------- template1 | 10 | 6 | ja_JP.UTF-8 | ja_JP.UTF-8 | t | t | -1 | 11563 | 648 | 1663 | | {=c/postgres,postgres=CTc/postgres} template0 | 10 | 6 | ja_JP.UTF-8 | ja_JP.UTF-8 | t | f | -1 | 11563 | 648 | 1663 | | {=c/postgres,postgres=CTc/postgres} postgres | 10 | 6 | ja_JP.UTF-8 | ja_JP.UTF-8 | f | t | -1 | 11563 | 648 | 1663 | | foo | 10 | 6 | ja_JP.UTF-8 | ja_JP.UTF-8 | f | t | -1 | 11563 | 648 | 1663 | | (4 行) #htmlinsertpcsp(db-btm.html,db-sp.html)
テキスト整形のルールを表示する