Re: [PATCH] Send numeric version to clients

From: Kevin Grittner <kgrittn(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Craig Ringer <craig(at)2ndquadrant(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Abhijit Menon-Sen <abhijit(dot)menon-sen(at)2ndquadrant(dot)com>, Petr Jelinek <petr(dot)jelinek(at)2ndquadrant(dot)com>
Subject: Re: [PATCH] Send numeric version to clients
Date: 2016-08-29 19:27:49
Message-ID: CACjxUsPOTtA7LtOYuKRY6izx-1d66=Z0Fg2BaYsZoT659s+3Vg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Aug 29, 2016 at 11:37 AM, Robert Haas <robertmhaas(at)gmail(dot)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");
Connection con =
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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2016-08-29 19:42:01 Re: [PATCH] Send numeric version to clients
Previous Message Rémi Zara 2016-08-29 18:40:18 Re: OpenSSL 1.1 breaks configure and more