Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dpJ5G-00083j-9m for pgsql-hackers@arkaria.postgresql.org; Tue, 05 Sep 2017 19:00:26 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dpJ5F-000442-Iy for pgsql-hackers@arkaria.postgresql.org; Tue, 05 Sep 2017 19:00:25 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dpJ3h-0001GN-TP for pgsql-hackers@postgresql.org; Tue, 05 Sep 2017 18:58:50 +0000 Received: from boipeva.ensmp.fr ([194.214.158.136] helo=cc-tupan-roaming-b.ensmp.fr) by makus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dpJ3a-00067G-9L for pgsql-hackers@postgresql.org; Tue, 05 Sep 2017 18:58:48 +0000 Received: from cri.ensmp.fr (13.237.219.88.rev.sfr.net [88.219.237.13]) (authenticated bits=0) by cc-tupan-roaming-b.ensmp.fr (8.15.2/8.15.2/JMMC-22/Oct/2013) with ESMTPSA id v85Iwbgq020098 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 5 Sep 2017 20:58:37 +0200 Date: Tue, 5 Sep 2017 20:58:37 +0200 (CEST) From: Fabien COELHO X-X-Sender: fabien@lancre To: Simon Riggs cc: Tom Lane , Robert Haas , "pgsql-hackers@postgresql.org" Subject: Re: [COMMITTERS] pgsql: Add psql variables showing server version and psql version. In-Reply-To: Message-ID: References: <2774.1504628172@sss.pgh.pa.us> <4782.1504630716@sss.pgh.pa.us> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-Miltered: at cc-tupan-roaming-b.ensmp.fr with ID 59AEF3DD.000 by Joe's j-chkmail (http : // j-chkmail dot ensmp dot fr)! X-j-chkmail-Auth: USER-ID fabien.coelho X-j-chkmail-Enveloppe: 59AEF3DD.000 from 13.237.219.88.rev.sfr.net/13.237.219.88.rev.sfr.net/88.219.237.13/cri.ensmp.fr/ 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 Hello Simon, > Does raise the further question of how psql behaves when we connect to > a pre-10 server, so we have SERVER_VERSION_NUM but yet it is not set. > How does this > \if SERVER_VERSION_NUM < x The if does not have expressions (yet), it just handles TRUE/ON/1 and FALSE/0/OFF. > Do we need some macro or suggested special handling? If "SERVER_VERSION_NUM" is available in 10, then: -- exit if version < 10 (\if is ignored and \q is executed) \if false \echo "prior 10" \q \endif -- then test version through a server side expression, will work SELECT :SERVER_VERSION_NUM < 110000 AS prior_11 \gset \if :prior_11 -- version 10 \else -- version 11 or more \endif -- Fabien. -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers