Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dpIVJ-00068A-DS for pgsql-hackers@arkaria.postgresql.org; Tue, 05 Sep 2017 18:23:17 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dpIVI-0006wV-QS for pgsql-hackers@arkaria.postgresql.org; Tue, 05 Sep 2017 18:23:16 +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 1dpIVH-0006vN-JE for pgsql-hackers@postgresql.org; Tue, 05 Sep 2017 18:23:15 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dpIV7-0005MZ-7R for pgsql-hackers@postgresql.org; Tue, 05 Sep 2017 18:23:14 +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 v85IN3Ct008506; Tue, 5 Sep 2017 14:23:03 -0400 From: Tom Lane To: Simon Riggs cc: Robert Haas , "pgsql-hackers@postgresql.org" Subject: Re: [COMMITTERS] pgsql: Add psql variables showing server version and psql version. In-reply-to: <7437.1504634344@sss.pgh.pa.us> References: <2774.1504628172@sss.pgh.pa.us> <4782.1504630716@sss.pgh.pa.us> <7437.1504634344@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Tue, 05 Sep 2017 13:59:04 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <8504.1504635783.1@sss.pgh.pa.us> Date: Tue, 05 Sep 2017 14:23:03 -0400 Message-ID: <8505.1504635783@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 I wrote: > 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 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. 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