[pgsql-jp: 42017] Re: postgresql10 のpsqlの\d [シーケンス名]の出力について
TAKATSUKA Haruka
harukat @ postgresql.jp
2019年 4月 12日 (金) 02:33:15 UTC
高塚と申します。
こうすれば似たような出力が得られますよ。
```
psql (11.1)
Type "help" for help.
db1=# SELECT tableoid, * FROM seq1 ;
tableoid | last_value | log_cnt | is_called
----------+------------+---------+-----------
49659 | 1 | 32 | t
(1 row)
db1=# SELECT * FROM pg_sequence WHERE seqrelid IN (SELECT tableoid FROM seq1);
seqrelid | seqtypid | seqstart | seqincrement | seqmax | seqmin | seqcache | seqcycle
----------+----------+----------+--------------+---------------------+--------+----------+----------
49659 | 20 | 1 | 1 | 9223372036854775807 | 1 | 1 | f
(1 row)
```
On Thu, 11 Apr 2019 18:56:59 +0900
"GOTO, Daisuke" <gotoh @ m-design.com> wrote:
> 後藤と申します。
>
> システム更新によりpostgres9系から10系への移行について調査しているのですが、
> 基本的なところで psql で \d [シーケンス名] とした時の出力が異なっていて
> 戸惑っております。
> 特にlast_value が参照できないのが少々不便に感じております。
> (一応 select * from [シーケンス名] で参照は出来るようですが)
>
> これはもう、そういうものなのでしょうか。
> あるいは何か設定をすれば9系の頃と互換な出力が得られるものなのでしょうか。
> お分かりの方がいらっしゃいましたらご教授願います。
>
> よろしくお願いいたします。
>
> --
> ・postgresql96-9.6.8-1PGDG.rhel7.x86_64 の psql の場合
> $ psql -U postgres -h my_server96 my_database96
> psql (9.6.8)
> "help" でヘルプを表示します.
>
> my_database96=# \d my_sequence
> シーケンス "public.my_sequence"
> 列 | 型 | 値
> ---------------+---------+---------------------
> sequence_name | name | my_sequence
> last_value | bigint | 68
> start_value | bigint | 1
> increment_by | bigint | 1
> max_value | bigint | 9223372036854775807
> min_value | bigint | 1
> cache_value | bigint | 1
> log_cnt | bigint | 32
> is_cycled | boolean | f
> is_called | boolean | t
>
> my_database96=# select * from my_sequence;
> sequence_name | last_value | start_value | increment_by | max_value |
> min_value | cache_value | log_cnt | is_cycled | is_called
> ---------------+------------+-------------+--------------+---------------------+
> -----------+-------------+---------+-----------+-----------
> my_sequence | 68 | 1 | 1 | 9223372036854775807 |
> 1 | 1 | 32 | f | t
> (1 行)
>
>
> --
>
> ・postgresql10-10.7-2PGDG.rhel7.x86_64 の psql の場合
>
> $ psql -U postgres -h my_server10 my_database10
> psql (10.7)
> "help" でヘルプを表示します。
> my_database10=# \d my_sequence
> シーケンス "public.my_sequence"
> 型 | 開始 | 最小 | 最大 | 増分 | 循環? | キャッシュ
> --------+------+------+---------------------+------+--------+------------
> bigint | 1 | 1 | 9223372036854775807 | 1 | no | 1
>
> my_database10=# select * from my_sequence;
> last_value | log_cnt | is_called
> ------------+---------+-----------
> 68 | 32 | t
> (1 行)
>
> --
______________________________________________________________________
日本PostgreSQLユーザ会 高塚 遥
〒171-0022 東京都豊島区南池袋2-32-8 SRA OSS 日本支社 内 JPUG
pgsql-jp メーリングリストの案内