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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Make psql's \set display variables in alphabetical order.
Date: 2017-02-01 16:25:25
Message-ID: E1cYxin-0006mD-0s@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

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: https://postgr.es/m/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(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message David Fetter 2017-02-01 17:18:40 Re: [COMMITTERS] pgsql: Make psql's \set display variables in alphabetical order.
Previous Message Tom Lane 2017-02-01 16:02:46 pgsql: Improve psql's behavior for \set and \unset of its control varia

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2017-02-01 16:26:03 Re: Bug in Physical Replication Slots (at least 9.5)?
Previous Message Daniel Verite 2017-02-01 16:18:58 Re: Improvements in psql hooks for variables