Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dpGWV-00007r-Na for pgsql-hackers@arkaria.postgresql.org; Tue, 05 Sep 2017 16:16:23 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dpGWV-0004ZY-24 for pgsql-hackers@arkaria.postgresql.org; Tue, 05 Sep 2017 16:16:23 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dpGWT-0004UO-J4 for pgsql-hackers@postgreSQL.org; Tue, 05 Sep 2017 16:16:21 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dpGWM-0006Wg-Ob for pgsql-hackers@postgreSQL.org; Tue, 05 Sep 2017 16:16:21 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id v85GGCDx002775; Tue, 5 Sep 2017 12:16:12 -0400 From: Tom Lane To: Simon Riggs cc: pgsql-hackers@postgreSQL.org Subject: Re: [COMMITTERS] pgsql: Add psql variables showing server version and psql version. In-reply-to: References: Comments: In-reply-to Simon Riggs message dated "Tue, 05 Sep 2017 08:29:15 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2772.1504628172.1@sss.pgh.pa.us> Date: Tue, 05 Sep 2017 12:16:12 -0400 Message-ID: <2774.1504628172@sss.pgh.pa.us> List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org [ redirecting to -hackers for wider comment ] Simon Riggs writes: > On 5 September 2017 at 07:51, Tom Lane wrote: >> Add psql variables showing server version and psql version. >> >> We already had a psql variable VERSION that shows the verbose form of >> psql's own version. Add VERSION_NAME to show the short form (e.g., >> "11devel") and VERSION_NUM to show the numeric form (e.g., 110000). >> Also add SERVER_VERSION_NAME and SERVER_VERSION_NUM to show the short and >> numeric forms of the server's version. (We'd probably add SERVER_VERSION >> with the verbose string if it were readily available; but adding another >> network round trip to get it seems too expensive.) >> >> The numeric forms, in particular, are expected to be useful for scripting >> purposes, now that psql can do conditional tests. > This is good. > Please can we backpatch these are far as they will go (easily)? > There is very little risk in doing so and significant benefits in > being able to rely on scripts that know about versions. Hm. I think it would be a fine idea to push this change into v10, so that all psql versions that have \if would have these variables. However, I'm less enthused about adding them to the 9.x branches. Given the lack of \if, I'm not seeing a use-case that would justify taking any compatibility risk for. Opinions anyone? regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers