Re: psql \d for wide tables / pattern for individual columns

From: Euler Taveira <euler(at)timbira(dot)com(dot)br>
To: Justin Pryzby <pryzby(at)telsasoft(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: psql \d for wide tables / pattern for individual columns
Date: 2019-11-11 01:01:04
Message-ID: CAHE3wggcZWXgdjwN0HoH8oevq0x_N7ybdoRn29ns6w-Qr2N7KA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Em dom., 10 de nov. de 2019 às 18:29, Justin Pryzby
<pryzby(at)telsasoft(dot)com> escreveu:
>
> We have some very wide tables (historically, up to 1600 columns ; this is
> improved now, but sometimes still several hundred, with numerous pages output
> to psql pager). Is is reasonable to suggest adding a psql command to show a
> table's definition, without all the columns listed?
>
It seems a good idea. However, I'm afraid adding a second argument
could limit our capabilities to match/suppress other table properties
in the future. For example, I think psql might have a way to omit
indexes, FKs, partitions, some column properties, or even show GRANTs
for that table. I don't have a concrete plan at the moment but maybe
someone else already thought about it.

> Or limit display to matching columns ? That's more general than the above
> functionality, if "empty string" is taken to mean "show no columns", like \d
> table "" or \d table *id or \d table ????
>
> Attached minimal patch for the latter.
>
> postgres=# \d pg_attribute ""
> Table "pg_catalog.pg_attribute"
> Column | Type | Collation | Nullable | Default
> --------+------+-----------+----------+---------
> Indexes:
> "pg_attribute_relid_attnam_index" UNIQUE, btree (attrelid, attname)
> "pg_attribute_relid_attnum_index" UNIQUE, btree (attrelid, attnum)
>
The problem with your proposal is that I can't differentiate a
complete output from another suppress-some-columns output if you don't
provide the meta-command. I think you should explicitly show that some
columns were suppressed (something like "... suppressed columns..."
after the list of matched columns). If you don't, it could lead to
confusion while reporting table description.

--
Euler Taveira Timbira -
http://www.timbira.com.br/
PostgreSQL: Consultoria, Desenvolvimento, Suporte 24x7 e Treinamento

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2019-11-11 01:13:11 Re: CountDBSubscriptions check in dropdb
Previous Message Michael Paquier 2019-11-11 00:02:01 Re: [bug fix] Produce a crash dump before main() on Windows