On Mon, Nov 13, 2017 at 5:21 AM, Tom Lane <t...@sss.pgh.pa.us> wrote: > Pavel Stehule <pavel.steh...@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