LoginSignup
5
5

More than 5 years have passed since last update.

postgresqlのページャーをON/OFF

Posted at

postgresのコマンドでターミナルのウインドウに収まらない場合、more表示のようになります。
以下のように「--続ける--」が出てリターンを打つと次の表示に移るみたいな。

testdb=> \l
                                         データベース一覧
   名前    |  所有者  | エンコーディング |  照合順序   | Ctype(変換演算子) |      アクセス権       
-----------+----------+------------------+-------------+-------------------+-----------------------
 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
 testdb    | postgres | UTF8             | ja_JP.UTF-8 | ja_JP.UTF-8       | 
 testdb10  | postgres | UTF8             | ja_JP.UTF-8 | ja_JP.UTF-8       | 
 testdb11  | postgres | UTF8             | ja_JP.UTF-8 | ja_JP.UTF-8       | 
 testdb12  | postgres | UTF8             | ja_JP.UTF-8 | ja_JP.UTF-8       | 
 testdb13  | postgres | UTF8             | ja_JP.UTF-8 | ja_JP.UTF-8       | 
 testdb14  | postgres | UTF8             | ja_JP.UTF-8 | ja_JP.UTF-8       | 
 testdb15  | postgres | UTF8             | ja_JP.UTF-8 | ja_JP.UTF-8       | 
 testdb16  | postgres | UTF8             | ja_JP.UTF-8 | ja_JP.UTF-8       | 
 testdb2   | postgres | UTF8             | ja_JP.UTF-8 | ja_JP.UTF-8       | 
--続ける--

  ↑これ
場合によっては便利なのかもしれませんが個人的にいらないです。文字化けとかするし。
これをOFFにするには以下のようにします。

testdb=> \pset pager off
「ページャを使う」は off です。
testdb=> \l
                                         データベース一覧
   名前    |  所有者  | エンコーディング |  照合順序   | Ctype(変換演算子) |      アクセス権       
-----------+----------+------------------+-------------+-------------------+-----------------------
 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
 testdb    | postgres | UTF8             | ja_JP.UTF-8 | ja_JP.UTF-8       | 
 testdb10  | postgres | UTF8             | ja_JP.UTF-8 | ja_JP.UTF-8       | 
 testdb11  | postgres | UTF8             | ja_JP.UTF-8 | ja_JP.UTF-8       | 
 testdb12  | postgres | UTF8             | ja_JP.UTF-8 | ja_JP.UTF-8       | 
 testdb13  | postgres | UTF8             | ja_JP.UTF-8 | ja_JP.UTF-8       | 
 testdb14  | postgres | UTF8             | ja_JP.UTF-8 | ja_JP.UTF-8       | 
 testdb15  | postgres | UTF8             | ja_JP.UTF-8 | ja_JP.UTF-8       | 
 testdb16  | postgres | UTF8             | ja_JP.UTF-8 | ja_JP.UTF-8       | 
 testdb2   | postgres | UTF8             | ja_JP.UTF-8 | ja_JP.UTF-8       | 
 testdb3   | postgres | UTF8             | ja_JP.UTF-8 | ja_JP.UTF-8       | 
 testdb4   | postgres | UTF8             | ja_JP.UTF-8 | ja_JP.UTF-8       | 
 testdb5   | postgres | UTF8             | ja_JP.UTF-8 | ja_JP.UTF-8       | 
 testdb6   | postgres | UTF8             | ja_JP.UTF-8 | ja_JP.UTF-8       | 
 testdb7   | postgres | UTF8             | ja_JP.UTF-8 | ja_JP.UTF-8       | 
 testdb8   | postgres | UTF8             | ja_JP.UTF-8 | ja_JP.UTF-8       | 
 testdb9   | postgres | UTF8             | ja_JP.UTF-8 | ja_JP.UTF-8       | 
(19 行)

testdb=> 

戻すにはonにします。

testdb=> \pset pager on
出力が長い場合はページャが使われます。
testdb=> 

5
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
5