pgsql: Improve psql's \d command to show whether index columns are key

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Improve psql's \d command to show whether index columns are key
Date: 2018-07-19 18:54:12
Message-ID: E1fgE44-0005ap-QI@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Improve psql's \d command to show whether index columns are key columns.

This is essential information when looking at an index that has
"included" columns. Per discussion, follow the style used in \dC
and some other places: column header is "Key?" and values are "yes"
or "no" (all translatable).

While at it, revise describeOneTableDetails to be a bit more maintainable:
avoid hard-wired column numbers and multiple repetitions of what needs
to be identical test logic. This also results in the emitted catalog
query corresponding more closely to what we print, which should be a
benefit to users of ECHO_HIDDEN mode, and perhaps a bit faster too
(the old logic sometimes asked for values it would not print, even
ones that are fairly expensive to get).

Discussion: https://postgr.es/m/21724.1531943735@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/90371a24a5367c357d7b046383dad8ee352b938b

Modified Files
--------------
src/bin/psql/describe.c | 269 ++++++++++++++------------
src/test/regress/expected/alter_table.out | 12 +-
src/test/regress/expected/create_index.out | 28 +--
src/test/regress/expected/index_including.out | 14 +-
src/test/regress/output/tablespace.source | 96 ++++-----
5 files changed, 224 insertions(+), 195 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2018-07-19 19:42:01 pgsql: Remove undocumented restriction against duplicate partition key
Previous Message Alexander Korotkov 2018-07-19 18:27:03 pgsql: Fix handling of empty uncompressed posting list pages in GIN