Re: [PATCH] Send numeric version to clients - Mailing list pgsql-hackers

From Kevin Grittner
Subject Re: [PATCH] Send numeric version to clients
Date
Msg-id CACjxUsPOTtA7LtOYuKRY6izx-1d66=Z0Fg2BaYsZoT659s+3Vg@mail.gmail.com
Whole thread Raw
In response to Re: [PATCH] Send numeric version to clients  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: [PATCH] Send numeric version to clients  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Mon, Aug 29, 2016 at 11:37 AM, Robert Haas <robertmhaas@gmail.com> wrote:

> Note that these are all one-liners, and I bet the same is true in
> mostly other languages.  Even in notoriously verbose languages like
> Java or Cobol or ADA it can't be very hard.

Regarding Java, for anything above the driver itself the
JDBC API says the DatabaseMetaData class must implement these
methods:

int getDatabaseMajorVersion()   Retrieves the major version number of the underlying database.
int getDatabaseMinorVersion()   Retrieves the minor version number of the underlying database.
String getDatabaseProductVersion()   Retrieves the version number of this database product.

That *should* make it just a problem for the driver itself.  That
seems simple enough until you check what those methods have been
returning so far.  A somewhat minimal program to return these
values:

import java.sql.*;
public final class PrintVersion
{   public static void main(String[] args) throws Exception   {       Class.forName("org.postgresql.Driver");
Connectioncon =
 
DriverManager.getConnection("jdbc:postgresql://localhost/test?user=kgrittn");       DatabaseMetaData dbmd =
con.getMetaData();      System.out.println(dbmd.getDatabaseMajorVersion() + "  " +
 
dbmd.getDatabaseMinorVersion());       con.close();   }
}

... outputs this:

9  6

I'm not sure what the right thing to do is here.

--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



pgsql-hackers by date:

Previous
From: Rémi Zara
Date:
Subject: Re: OpenSSL 1.1 breaks configure and more
Next
From: Tom Lane
Date:
Subject: Re: [PATCH] Send numeric version to clients