psql: Update \d sequence display
authorPeter Eisentraut <peter_e@gmx.net>
Mon, 25 Sep 2017 15:59:46 +0000 (11:59 -0400)
committerPeter Eisentraut <peter_e@gmx.net>
Fri, 29 Sep 2017 17:37:30 +0000 (13:37 -0400)
commit2a14b9609df1de4f2eb5a97aff674aaad033a7e6
treee792edbfba4cef98513d0eee98ae850d7e6e968b
parent136ab7c5a5f54fecea7c28c8550c19123245acf0
psql: Update \d sequence display

For \d sequencename, the psql code just did SELECT * FROM sequencename
to get the information to display, but this does not contain much
interesting information anymore in PostgreSQL 10, because the metadata
has been moved to a separate system catalog.

This patch creates a newly designed sequence display that is not merely
an extension of the general relation/table display as it was previously.

Example:

PostgreSQL 9.6:

=> \d foobar
           Sequence "public.foobar"
    Column     |  Type   |        Value
---------------+---------+---------------------
 sequence_name | name    | foobar
 last_value    | bigint  | 1
 start_value   | bigint  | 1
 increment_by  | bigint  | 1
 max_value     | bigint  | 9223372036854775807
 min_value     | bigint  | 1
 cache_value   | bigint  | 1
 log_cnt       | bigint  | 0
 is_cycled     | boolean | f
 is_called     | boolean | f

PostgreSQL 10 before this change:

=> \d foobar
   Sequence "public.foobar"
   Column   |  Type   | Value
------------+---------+-------
 last_value | bigint  | 1
 log_cnt    | bigint  | 0
 is_called  | boolean | f

New:

=> \d foobar
                           Sequence "public.foobar"
  Type  | Start | Minimum |       Maximum       | Increment | Cycles? | Cache
--------+-------+---------+---------------------+-----------+---------+-------
 bigint |     1 |       1 | 9223372036854775807 |         1 | no      |     1

Reviewed-by: Fabien COELHO <coelho@cri.ensmp.fr>
src/bin/psql/describe.c
src/test/regress/expected/identity.out
src/test/regress/expected/sequence.out
src/test/regress/sql/identity.sql
src/test/regress/sql/sequence.sql