pgsql: Make psql's \set display variables in alphabetical order.

Started by Tom Lanealmost 9 years ago6 messages
#1Tom Lane
tgl@sss.pgh.pa.us

Make psql's \set display variables in alphabetical order.

"\set" with no arguments displays all defined variables, but it does so
in the order that they appear in variables.c's list, which previously
was mostly creation order. That makes the list ugly and hard to find
things in, and it exposes some psql implementation details to users.
(For instance, ordinary variables will move to the bottom of the list
if unset and set again, but variables that have hooks won't.)

Fix that by keeping the list in alphabetical order at all times, which
isn't much more complicated than breaking out of the insertion search
loops once we reach an entry that should be after the one to be inserted.

Discussion: /messages/by-id/31785.1485900786@sss.pgh.pa.us

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/c3e3844a92fe42109e4106314f7d229f784a7d0a

Modified Files
--------------
src/bin/psql/variables.c | 25 ++++++++++++++++++++-----
1 file changed, 20 insertions(+), 5 deletions(-)

--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers

#2David Fetter
david@fetter.org
In reply to: Tom Lane (#1)
Re: [COMMITTERS] pgsql: Make psql's \set display variables in alphabetical order.

On Wed, Feb 01, 2017 at 04:25:25PM +0000, Tom Lane wrote:

Make psql's \set display variables in alphabetical order.

This is a substantial usability improvement which nevertheless is hard
to imagine changes things that scripts relied on. I think it's worth
back-patching.

Best,
David.
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: David Fetter (#2)
Re: [COMMITTERS] pgsql: Make psql's \set display variables in alphabetical order.

David Fetter <david@fetter.org> writes:

On Wed, Feb 01, 2017 at 04:25:25PM +0000, Tom Lane wrote:

Make psql's \set display variables in alphabetical order.

This is a substantial usability improvement which nevertheless is hard
to imagine changes things that scripts relied on. I think it's worth
back-patching.

I'm not that excited about it personally, but I agree it would be unlikely
to break anything. Other votes?

regards, tom lane

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#4Andres Freund
andres@anarazel.de
In reply to: Tom Lane (#3)
Re: [COMMITTERS] pgsql: Make psql's \set display variables in alphabetical order.

On 2017-02-01 12:59:36 -0500, Tom Lane wrote:

David Fetter <david@fetter.org> writes:

On Wed, Feb 01, 2017 at 04:25:25PM +0000, Tom Lane wrote:

Make psql's \set display variables in alphabetical order.

This is a substantial usability improvement which nevertheless is hard
to imagine changes things that scripts relied on. I think it's worth
back-patching.

I'm not that excited about it personally, but I agree it would be unlikely
to break anything. Other votes?

-0.5 - I see very little reason to backpatch this over dozes of other
changes.

- Andres

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#5Robert Haas
robertmhaas@gmail.com
In reply to: Andres Freund (#4)
Re: [COMMITTERS] pgsql: Make psql's \set display variables in alphabetical order.

On Wed, Feb 1, 2017 at 1:08 PM, Andres Freund <andres@anarazel.de> wrote:

On 2017-02-01 12:59:36 -0500, Tom Lane wrote:

David Fetter <david@fetter.org> writes:

On Wed, Feb 01, 2017 at 04:25:25PM +0000, Tom Lane wrote:

Make psql's \set display variables in alphabetical order.

This is a substantial usability improvement which nevertheless is hard
to imagine changes things that scripts relied on. I think it's worth
back-patching.

I'm not that excited about it personally, but I agree it would be unlikely
to break anything. Other votes?

-0.5 - I see very little reason to backpatch this over dozes of other
changes.

I'll vote -1. I don't think this is a bug fix.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#6David Fetter
david@fetter.org
In reply to: Robert Haas (#5)
Re: [COMMITTERS] pgsql: Make psql's \set display variables in alphabetical order.

On Wed, Feb 01, 2017 at 04:38:59PM -0500, Robert Haas wrote:

On Wed, Feb 1, 2017 at 1:08 PM, Andres Freund <andres@anarazel.de> wrote:

On 2017-02-01 12:59:36 -0500, Tom Lane wrote:

David Fetter <david@fetter.org> writes:

On Wed, Feb 01, 2017 at 04:25:25PM +0000, Tom Lane wrote:

Make psql's \set display variables in alphabetical order.

This is a substantial usability improvement which nevertheless is hard
to imagine changes things that scripts relied on. I think it's worth
back-patching.

I'm not that excited about it personally, but I agree it would be unlikely
to break anything. Other votes?

-0.5 - I see very little reason to backpatch this over dozes of other
changes.

I'll vote -1. I don't think this is a bug fix.

I withdraw my suggestion.

Best,
David.
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers