Thread: 9.0 JDBC driver reporting invalid primary key meta data

9.0 JDBC driver reporting invalid primary key meta data

From
"Adam Rauch"
Date:

Requesting primary key meta data via the JDBC driver [i.e., conn.getMetaData().getPrimaryKeys()] against PostgreSQL 9.0 reports incorrect meta data for tables whose PK column(s) has been renamed. I’m testing this against the latest 9.0 driver (http://jdbc.postgresql.org/download/postgresql-9.0dev-800.jdbc4.jar) and the PostgreSQL 9.0 Beta 4 release. I initially reported this problem during Beta 1 to the pgsql-testers alias; more details and repro code are here: http://archives.postgresql.org/pgsql-testers/2010-05/msg00003.php

 

My understanding is this is an intentional compatibility break by the server team that will require a change to the JDBC driver. The issue is of course trivial to avoid or work around in a test environment, but it’s a showstopper for production environments. Many applications like ours must operate on tables, columns, and constraints without any inherent knowledge of or control over these database objects or their history; we rely exclusively on information from the database server and simply can’t function with invalid meta data being reported.

 

Let me know if you need more information or if I can help with testing, debugging, etc.

 

Thanks,

Adam

Re: 9.0 JDBC driver reporting invalid primary key meta data

From
Kris Jurka
Date:

On Tue, 3 Aug 2010, Adam Rauch wrote:

>
> Requesting primary key meta data via the JDBC driver [i.e.,
> conn.getMetaData().getPrimaryKeys()] against PostgreSQL 9.0 reports
> incorrect meta data for tables whose PK column(s) has been renamed.

I've just checked in a fix for this problem.  Also affected are
getIndexInfo and getBestRowIdentifier.

I've posted a jar file if you'd like to test this on your application.

http://www.ejurka.com/pgsql/jars/ar/

Kris Jurka

Re: 9.0 JDBC driver reporting invalid primary key meta data

From
"Adam Rauch"
Date:
Preliminary testing shows that this driver fixes the problem!  I'll keep
testing, but it looks great so far.

Thanks so much,
Adam

-----Original Message-----
From: Kris Jurka [mailto:books@ejurka.com]
Sent: Friday, August 06, 2010 3:07 PM
To: Adam Rauch
Cc: pgsql-jdbc@postgresql.org
Subject: Re: [JDBC] 9.0 JDBC driver reporting invalid primary key meta data



On Tue, 3 Aug 2010, Adam Rauch wrote:

>
> Requesting primary key meta data via the JDBC driver [i.e.,
> conn.getMetaData().getPrimaryKeys()] against PostgreSQL 9.0 reports
> incorrect meta data for tables whose PK column(s) has been renamed.

I've just checked in a fix for this problem.  Also affected are
getIndexInfo and getBestRowIdentifier.

I've posted a jar file if you'd like to test this on your application.

http://www.ejurka.com/pgsql/jars/ar/

Kris Jurka