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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Euler Taveira <euler(at)timbira(dot)com(dot)br>
Cc: Justin Pryzby <pryzby(at)telsasoft(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: psql \d for wide tables / pattern for individual columns
Date: 2019-11-11 15:46:07
Message-ID: 1492.1573487167@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Euler Taveira <euler(at)timbira(dot)com(dot)br> writes:
> 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.

Yeah, that was my immediate reaction to the proposed syntax as well.
I think we'd better make sure that we aren't foreclosing future
extensions of \d.

Maybe a reasonable idea is to expect that any additional arguments
are in "keyword=value" style, so that the immediate need could be
met with

\d mytable columns=<pattern>

It might already be worthwhile to allow both positive and negative
patterns, so also

\d mytable exclude_columns=<pattern>

> 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.

Hm ... "N columns suppressed" might sometimes be useful, but I'm afraid
it would take an extra query to get it, and I'm not sure it's worth it.
I think someone who's using these options would already know perfectly
well what they're hiding. We don't expect, say, "\dt my*" to tell you
how many tables it didn't list.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2019-11-11 15:56:51 Re: [PATCH] Fix PostgreSQL server build and install problems under MSYS2
Previous Message Gilles Darold 2019-11-11 15:43:18 Re: [PATCH][DOC] Fix for PREPARE TRANSACTION doc and postgres_fdw message.