Re: Better title output for psql \dt \di etc. commands

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Better title output for psql \dt \di etc. commands
Дата
Msg-id 446877.1738613577@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Better title output for psql \dt \di etc. commands  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Better title output for psql \dt \di etc. commands
Список 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 по дате отправления: