From: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
To: pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: \describe*
Date: 2018-01-26 01:11:00
Message-ID: CADkLM=eHUZEMi+M=JjvbdLNBSW6oiSYBpadEq0hvXhtoQd+vfw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox
Lists: pgsql-hackers

Some of the discussions about making psql more user friendly (more tab
completions help, exit, etc) got me thinking about other ways that psql
could be more friendly, and the one that comes to mind is our terse but
cryptic \d* commands.

I think it would be helpful and instructive to have corresponding long-form
describe commands.

Take describing schemas. Is \dn intuitive? Not really. In hindsight, you
may think "yeah, a schema is a namespace", but you never guessed 'n' on the
first try, or the second.

Looking over exec_command_d() a bit, I think it's a bit of a stretch do
have each command handle a long form like this:

\describe table my_table
\describe table verbose my_table

because then each \d-variant has to account for objects named "table" and
"verbose" and that's a path to unhappiness.

But if we dash-separated them, then all of the strcmps would be in the 'e'
subsection, and each one would just have to know it's long to short
translation, and call exec_command_d with the corresponding short command

describe => d
describe-verbose => d+
describe-aggregates-verbose => da+
describe-roles => du

We could even presume the verbose flag in all cases (after all, the user
was being verbose...), which would also cut down on tab-completion results,
and we could check for interactive mode and display a message like

\describe-schemas (short: \dn+)

so that the person has the opportunity to learn the corresponding short

In additional to aiding tab completion discovery of the commands (i.e.
typing "\desc" and then hitting tab, it would also make scripts a little
more self-documenting.



Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2018-01-26 01:12:54 Re: Removing WITH clause support in CREATE FUNCTION, for isCachable and isStrict
Previous Message Michael Paquier 2018-01-26 01:10:25 Re: [HACKERS] GnuTLS support