Re: Variable substitution in psql backtick expansion

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Corey Huinker <corey(dot)huinker(at)gmail(dot)com>, Daniel Verite <daniel(at)manitou-mail(dot)org>, PostgreSQL Developers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Variable substitution in psql backtick expansion
Date: 2017-08-26 15:08:56
Message-ID: 20786.1503760136@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr> writes:
>> OK, but if human-friendly display is the use-case then it ought to
>> duplicate what psql itself would print in, eg, the startup message about
>> server version mismatch. The v4 patch does not, in particular it neglects
>> PQparameterStatus(pset.db, "server_version"). This would result in
>> printing, eg, "11.0" when the user would likely rather see "11devel".

> 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).

> In summary, my prefered option is to have:
> CLIENT_VERSION "PostgreSQL 11devel on ..."
> CLIENT_VERSION_NAME "11devel"
> CLIENT_VERSION_NUM 110000

I don't think we want to drop :VERSION; that would accomplish little
beyond breaking existing scripts. Plausible choices include duplicating
it, like:

VERSION "PostgreSQL 11devel on ..."
CLIENT_VERSION "PostgreSQL 11devel on ..."
CLIENT_VERSION_NAME "11devel"
CLIENT_VERSION_NUM 110000

or just ignoring the discrepancy:

VERSION "PostgreSQL 11devel on ..."
CLIENT_VERSION_NAME "11devel"
CLIENT_VERSION_NUM 110000

or just leaving "CLIENT" implicit for all of these variables:

VERSION "PostgreSQL 11devel on ..."
VERSION_NAME "11devel"
VERSION_NUM 110000

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?)

> 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.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabien COELHO 2017-08-26 15:38:15 Re: psql - add ability to test whether a variable exists
Previous Message Tomas Vondra 2017-08-26 14:14:24 Re: PATCH: multivariate histograms and MCV lists