Re: Variable substitution in psql backtick expansion

Fabien COELHO <coelho@cri.ensmp.fr>

From: Fabien COELHO <coelho@cri.ensmp.fr>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Robert Haas <robertmhaas@gmail.com>, Pavel Stehule <pavel.stehule@gmail.com>, Corey Huinker <corey.huinker@gmail.com>, Daniel Verite <daniel@manitou-mail.org>, PostgreSQL Developers <pgsql-hackers@postgresql.org>
Date: 2017-08-26T16:40:05Z
Lists: pgsql-hackers

Attachments

Hello Tom,

>> I understand that you would prefer VERSION_NAME to show something like
>>    "11devel, server 9.6.4"

> No, that's not what I said.  I'm just complaining that as the patch stands
> it will set SERVER_NAME to "11.0", where I think it should say "11devel"
> (as of today).

Ok.

>   [...]
>   VERSION "PostgreSQL 11devel on ..."
>   CLIENT_VERSION_NAME "11devel"
>   CLIENT_VERSION_NUM 110000

This kind of inconsistencies is hard for human memory:-(

> or just leaving "CLIENT" implicit for all of these variables:
>
>   VERSION "PostgreSQL 11devel on ..."
>   VERSION_NAME "11devel"
>   VERSION_NUM 110000

That is already what the patch does, because of the VERSION precedent.

> Robert seems to prefer the last of those, and that'd be fine with me.
> (Note that CLIENT is ambiguous anyway: does it mean psql itself, or
> libpq?)

Hmmm. Indeed.

>>    SERVER_VERSION_NAME "9.6.4"
>>    SERVER_VERSION_NUM 090604
>
> I'm on board with this, except I don't think we should have any leading
> zero in the numeric form.  There are contexts where somebody might think
> that means octal.

Indeed. The implementation already does this, I just typed it without 
checking.

So basically the only thing needed from Robert & you seems to change 
"11.0" to "11devel", which is fine with me.

The attached v5 does that.

-- 
Fabien.

Commits

  1. Add psql variables showing server version and psql version.

  2. Reformat psql's --help=variables output.

  3. Remove reinvention of stringify macro.

  4. Allow psql variable substitution to occur in backtick command strings.