Re: psql \d for wide tables / pattern for individual columns - Mailing list pgsql-hackers

From Tom Lane
Subject Re: psql \d for wide tables / pattern for individual columns
Date
Msg-id 1492.1573487167@sss.pgh.pa.us
Whole thread Raw
In response to Re: psql \d for wide tables / pattern for individual columns  (Euler Taveira <euler@timbira.com.br>)
List pgsql-hackers
Euler Taveira <euler@timbira.com.br> writes:
> Em dom., 10 de nov. de 2019 às 18:29, Justin Pryzby
> <pryzby@telsasoft.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



pgsql-hackers by date:

Previous
From: Gilles Darold
Date:
Subject: Re: [PATCH][DOC] Fix for PREPARE TRANSACTION doc and postgres_fdwmessage.
Next
From: Tom Lane
Date:
Subject: Re: [PATCH] Fix PostgreSQL server build and install problems under MSYS2