Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eo2dn-00070W-RZ for pgsql-jdbc@arkaria.postgresql.org; Tue, 20 Feb 2018 07:47:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eo2dm-0000Qe-JQ for pgsql-jdbc@arkaria.postgresql.org; Tue, 20 Feb 2018 07:47:06 +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 1eo2dm-0000QU-Dy for pgsql-jdbc@lists.postgresql.org; Tue, 20 Feb 2018 07:47:06 +0000 Received: from [195.159.176.226] (helo=blaine.gmane.org) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1eo2dk-0005lY-5i for pgsql-jdbc@postgresql.org; Tue, 20 Feb 2018 07:47:05 +0000 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1eo2bQ-0001WA-78 for pgsql-jdbc@postgresql.org; Tue, 20 Feb 2018 08:44:40 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-jdbc@postgresql.org From: Thomas Kellerer Subject: Re: JDBC driver returns different version strings on Ubuntu and CentOS Date: Tue, 20 Feb 2018 08:46:14 +0100 Lines: 40 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Complaints-To: usenet@blaine.gmane.org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666 In-Reply-To: Content-Language: de-DE X-Host-Lookup-Failed: Reverse DNS lookup failed for 195.159.176.226 (failed) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hmm, there must be _some_ parsing going on, because select current_setting('server_version') returns "10.2 (Ubuntu 10.2-1.pgdg16.04+1)" on the Ubuntu installation, so I wonder how the 10.2.2 is created from that by the JDBC driver. It is not really important, I am just wondering... Regards Thomas Jorge Solórzano schrieb am 19.02.2018 um 18:04: > The DatabaseMetaData.getDatabaseProductVersion() returns the exact > string of ParameterStatus "server_version", and this version can be > different from ditro to distro, in my Ubuntu the "server_version" > returns: "10.2 (Ubuntu 10.2-1.pgdg16.04+1)". In other words the > version returned is not "parsed/cleaned", and if you need to > implement some logic based on the version, is better to use > getDatabaseMajorVersion() and getDatabaseMinorVersion(). > > Regards. > > On Mon, Feb 19, 2018 at 9:52 AM, Thomas Kellerer > wrote: > > I have just noticed that DatabaseMetaData.getDatabaseProductVersion() returns the String "10.2.2" when connected to a server running on Ubuntu, but returns "10.2" when connected to a server running on CentOS or Windows. > > Is there a specific reason for this? > > It's a bit confusing because 10.2.2 doesn't actually exists as a "real" Postgres version. > > This happens with the driver versions 42.1.4 and 42.2.1 (haven tried others) > > Regards > Thomas > > > >