Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dpJ6O-0008Az-TY for pgsql-hackers@arkaria.postgresql.org; Tue, 05 Sep 2017 19:01:37 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dpJ6O-00048I-G0 for pgsql-hackers@arkaria.postgresql.org; Tue, 05 Sep 2017 19:01:36 +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 1dpJ6M-00045x-O6 for pgsql-hackers@postgresql.org; Tue, 05 Sep 2017 19:01:34 +0000 Received: from jiboia.ensmp.fr ([194.214.158.138] helo=cc-tupan-roaming-a.ensmp.fr) by makus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dpJ6G-0006Cv-23 for pgsql-hackers@postgresql.org; Tue, 05 Sep 2017 19:01:33 +0000 Received: from cri.ensmp.fr (13.237.219.88.rev.sfr.net [88.219.237.13]) (authenticated bits=0) by cc-tupan-roaming-a.ensmp.fr (8.15.2/8.15.2/JMMC-22/Oct/2013) with ESMTPSA id v85J1PnL030856 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 5 Sep 2017 21:01:26 +0200 Date: Tue, 5 Sep 2017 21:01:25 +0200 (CEST) From: Fabien COELHO X-X-Sender: fabien@lancre To: Tom Lane cc: Simon Riggs , Robert Haas , "pgsql-hackers@postgresql.org" Subject: Re: [COMMITTERS] pgsql: Add psql variables showing server version and psql version. In-Reply-To: <8505.1504635783@sss.pgh.pa.us> Message-ID: References: <2774.1504628172@sss.pgh.pa.us> <4782.1504630716@sss.pgh.pa.us> <7437.1504634344@sss.pgh.pa.us> <8505.1504635783@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-a.ensmp.fr with ID 59AEF485.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: 59AEF485.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 >> Huh? The variable will be set in any case. It should be correct for any >> server version we might find in the wild --- so far as I can tell from the >> commit history, every version supporting FE/BE protocol version 3 has sent >> server_version at connection start. With a pre-7.4 server, it looks like >> the variables would be set to "0.0.0" and "0" respectively. > > Scratch that: experimentation says it works fine with older servers too. > The oldest one I have in captivity reports Ok, be it means a recent psql connecting to an old server. It does not work with an old psql. > SERVER_VERSION_NAME = '7.0.3' > SERVER_VERSION_NUM = '70003' > > Looking more closely, I see that when using protocol version 2, libpq > will issue a "select version()" command at connection start to get > this info. Then it could be used for free to set SERVER_VERSION if it can be extracted from libpq somehow?! -- Fabien. -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers