Re: [HACKERS] Variable substitution in psql backtick expansion - Mailing list pgsql-hackers

From Fabien COELHO
Subject Re: [HACKERS] Variable substitution in psql backtick expansion
Date
Msg-id alpine.DEB.2.20.1708260747110.3627@lancre
Whole thread Raw
In response to Re: [HACKERS] Variable substitution in psql backtick expansion  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [HACKERS] Variable substitution in psql backtick expansion
List pgsql-hackers
Hello Tom,

>>> ...  I'm still not sure that there's any use case for the
>>> string versions ("9.6.4" etc).
>
>> If somebody's doing comparisons, they probably want the numeric
>> version, but somebody might want to print the string version in an
>> error message e.g. \if <test involving VERSION_NUM> \echo this thing
>> doesn't work on :VERSION_NAME \quit \endif
>
> 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"

Instead of the current "11devel" when there is a client/server mismatch? I 
do not like it much. Note that the server version is already available as 
:SERVER_NAME/NUM.

Moreover I would like to point out that pre-existing :VERSION does not do 
such a thing. I was just extending it to have something more convenient 
and simple, hence the names.

Now they can be named :CLIENT_VERSION_NAME/NUM instead, as suggested by 
Robert, but that would be a little bit inconsistent with the existing 
VERSION...

Or maybe we could rename it CLIENT_VERSION as well, and make the ambiguous 
VERSION be the "11devel, server 9.6.4" thing?

In summary, my prefered option is to have:  CLIENT_VERSION "PostgreSQL 11devel on ..."  CLIENT_VERSION_NAME "11devel"
CLIENT_VERSION_NUM110000  SERVER_VERSION_NAME "9.6.4"  SERVER_VERSION_NUM 090604  maybe SERVER_VERSION for the long
string? and VERSION as "11devel server 9.6.4" is no match, or just the short  string if match, so that it is nearly
upwardcompatible?
 

As always, the committer decides.

-- 
Fabien.



pgsql-hackers by date:

Previous
From: "yangjie@highgo.com"
Date:
Subject: [HACKERS] hash partitioning based on v10Beta2
Next
From: Fabien COELHO
Date:
Subject: [HACKERS] psql - add ability to test whether a variable exists