Re: [HACKERS] Re: proposal - psql: possibility to specify sort fordescribe commands, when size is printed - Mailing list pgsql-hackers

From Alexander Korotkov
Subject Re: [HACKERS] Re: proposal - psql: possibility to specify sort fordescribe commands, when size is printed
Date
Msg-id CAPpHfdtffj3aM4F+A-5ndCVU+8jxhcpSUB55JNwz5ia4_TK2=w@mail.gmail.com
Whole thread Raw
In response to Re: [HACKERS] Re: proposal - psql: possibility to specify sort fordescribe commands, when size is printed  (Magnus Hagander <magnus@hagander.net>)
Responses Re: [HACKERS] Re: proposal - psql: possibility to specify sort fordescribe commands, when size is printed  (Pavel Stehule <pavel.stehule@gmail.com>)
List pgsql-hackers
On Tue, Nov 14, 2017 at 3:26 PM, Magnus Hagander wrote: > On Mon, Nov 13, 2017 at 3:17 PM, Dean Rasheed > wrote: > >> On 28 October 2017 at 13:46, Pavel Stehule >> wrote: >> > I though about Alexander proposal, and I am thinking so it can be >> probably >> > best if we respect psql design. I implemented two command suffixes >> > (supported only when it has sense) "s" sorted by size and "d" as descent >> > >> > so list of tables can be sorted with commands: >> > >> > \dt+sd (in this case, the order is not strict), so command >> > \dtsd+ is working too (same \disd+ or \di+sd) >> > >> > These two chars are acceptable. Same principle is used for \l command >> > >> > \lsd+ or \l+sd >> > >> > What do you think about it? >> > >> >> I really hate that syntax. This is going to turn into an >> incomprehensible mess, and isn't easily extended to support other >> options. >> > > +1. While useful in itself, I think it's definitely a dangerous pattern to > go down, as it'll only get worse. > > > I agree with people who have said they would prefer this to be >> available as a per-command option rather than as a variable that you >> have to set, but it needs a clearer syntax. I actually like Stephen's >> idea of using a user-defined SQL snippet, because that's a familiar >> syntax to people, and it avoids adding an ever-increasing number of >> options to these commands. Instead, the syntax could simply be: >> > > +1 here as well. And anybody who is actually going to need this level of > control definitely will know SQL... > > And if one wants to save some "standard patterns", it should be doable to > save the pattern itself in a variable and then use it with something like > "\dt :mysort" and have it expand the normal way there. > +1 I agree, that would look better, especially with "standard patterns" which could help with too long to type each time SQL snippets. ------ Alexander Korotkov Postgres Professional: http://www.postgrespro.com The Russian Postgres Company

pgsql-hackers by date:

Previous
From: Alexander Korotkov
Date:
Subject: Re: [HACKERS] GSoC 2017 : Patch for predicate locking in Gist index
Next
From: Amit Khandekar
Date:
Subject: Re: [HACKERS] UPDATE of partition key