Re: Improvements in psql hooks for variables

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: "Daniel Verite" <daniel@manitou-mail.org>
Cc: "Rahila Syed" <rahilasyed90@gmail.com>, "Stephen Frost" <sfrost@snowman.net>, "Ashutosh Bapat" <ashutosh.bapat@enterprisedb.com>, "pgsql-hackers" <pgsql-hackers@postgresql.org>, "Andrew Dunstan" <andrew@dunslane.net>
Date: 2017-01-31T21:07:12Z
Lists: pgsql-hackers

Attachments

I wrote:
> Attached is a draft patch for that.  I chose to make a second hook rather
> than complicate the assign hook API, mainly because it allows more code
> sharing --- all the bool vars can share the same substitute hook, and
> so can the three-way vars as long as "on" and "off" are the appropriate
> substitutes.

> I only touched the behavior for bool vars here, but if people like this
> solution it could be fleshed out to apply to all the built-in variables.

Attached is a finished version that includes hooks for all the variables
for which they were clearly sensible.  (FETCH_COUNT doesn't seem to really
need one, and I didn't do anything with HISTSIZE or IGNOREEOF either.
It might be worth bringing the latter two into the hooks paradigm, but
that seems like fit material for a separate patch.)

I updated the documentation as well.  I think this is committable if
there are not objections.

			regards, tom lane

Commits

  1. Clean up psql's behavior for a few more control variables.

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

  3. Improve psql's behavior for \set and \unset of its control variables.

  4. Make psql reject attempts to set special variables to invalid values.