Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fnlMA-0002ul-Ub for pgsql-general@arkaria.postgresql.org; Thu, 09 Aug 2018 13:52:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fnlM8-0008JU-Vq for pgsql-general@arkaria.postgresql.org; Thu, 09 Aug 2018 13:52:00 +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.89) (envelope-from ) id 1fnlM8-0008JE-O0 for pgsql-general@lists.postgresql.org; Thu, 09 Aug 2018 13:52:00 +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.89) (envelope-from ) id 1fnlM2-0008T4-2y for pgsql-general@postgresql.org; Thu, 09 Aug 2018 13:52:00 +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 w79DppHZ026145; Thu, 9 Aug 2018 09:51:51 -0400 From: Tom Lane To: =?UTF-8?B?V8OoaSBDxY1uZ3J1w6w=?= cc: fluca1978@gmail.com, pgsql-general Subject: Re: select version() with internal number version? In-reply-to: References: Comments: In-reply-to =?UTF-8?B?V8OoaSBDxY1uZ3J1w6w=?= message dated "Thu, 09 Aug 2018 15:10:02 +0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <26143.1533822711.1@sss.pgh.pa.us> Date: Thu, 09 Aug 2018 09:51:51 -0400 Message-ID: <26144.1533822711@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk =?UTF-8?B?V8OoaSBDxY1uZ3J1w6w=?= writes: > On Thu, Aug 9, 2018 at 3:01 PM Luca Ferrari wrote: >> Is there any way to get directly the PostgreSQL version number? > SHOW server_version; > SHOW server_version_num; Also, if you're using libpq, see PQserverVersion() which (a) avoids a round trip to the server, and (b) works further back than server_version_num, though that issue is probably academic to most folk at this point (server_version_num appeared in 8.2). regards, tom lane