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

From Michael Paquier
Subject Re: [HACKERS] Variable substitution in psql backtick expansion
Date
Msg-id CAB7nPqQwx21AjTaui1d217m=_7T7=shL69TjbQk5AHrH4g=7zQ@mail.gmail.com
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  (Fabien COELHO <coelho@cri.ensmp.fr>)
List pgsql-hackers
On Mon, Nov 13, 2017 at 5:21 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Pavel Stehule <pavel.stehule@gmail.com> writes:
>> [ psql-server-version-2.patch ]
>
> I think this patch should be rejected.  It adds no new functionality;
> you can get the string in question with "select version()".  Moreover,
> you've been able to do that for lo these many years.  Any application
> that tried to depend on this new way of getting the string would fail
> when working with an older server or older psql.  That does not seem
> like a good property for a version check.  Also, because the string
> isn't especially machine-friendly, it's not very clear to me what the
> use-case is for an application to use it at all, rather than the other
> version formats we already provide.

+1 for rejection as version() returns PG_VERSION_STR already. It is
also already possible to define a VERSION variable psqlrc simply with
that:
\set VERSION 'version();'

+-- check consistency of SERVER_VERSION
+-- which is transmitted as GUC "server_version_raw"
+SELECT :'SERVER_VERSION' = VERSION()
+   AND :'SERVER_VERSION' = current_setting('server_version_raw')
+   AND :'SERVER_VERSION' = :'VERSION'
+       AS "SERVER_VERSION is consistent";
Not much enthusiastic with this test when thinking about cross-upgrades.
-- 
Michael


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: [HACKERS] PATCH: psql tab completion for SELECT
Next
From: Etsuro Fujita
Date:
Subject: Re: [HACKERS] Incorrect comment for build_child_join_rel