Re: Better title output for psql \dt \di etc. commands - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Better title output for psql \dt \di etc. commands
Date
Msg-id 446877.1738613577@sss.pgh.pa.us
Whole thread Raw
In response to Re: Better title output for psql \dt \di etc. commands  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Better title output for psql \dt \di etc. commands
List pgsql-hackers
Greg Sabino Mullane <htamfids@gmail.com> writes:
> I toyed with that for a bit, but as you say, without generating a ton of
> combinations to translate, we'd have to fall back on run-time
> constructions. Neither is ideal. I also realized that I almost never type
> "\dti". Very common for me are \d and \dt and \dv etc. but combinations are
> something I never bother with. At that point, I just do a \d. I think given
> how rare (granted, anecdotally) those combinations are, it's okay if we
> expose people to the "r" word.

Fair.  This is already a step forward, so it doesn't have to be
perfect.

Looking at the code, I'm not thrilled with the strspn() coding
method.  I'd much rather it relied on the bool flags we already
computed (showTables etc).  I'm wondering about adding a step like

    int ntypes = (int) showTables + (int) showIndexes + ...

(the explicit coercions to int probably aren't necessary)
and then the code could look like

    (ntypes != 1) ? _("List of relations") :
    (showTables) ? _("List of tables") :
    (showIndexes) ? _("List of indexes") :
    ...

"ntypes" could also be used to simplify the logic that forces
all the flags on, up at the top of the function.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Nathan Bossart
Date:
Subject: Re: Commitfest app release on Feb 17 with many improvements
Next
From: Nathan Bossart
Date:
Subject: Re: why there is not VACUUM FULL CONCURRENTLY?