JDBC pg_description update needed for CVS tip

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-jdbc(at)postgresql(dot)org
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: JDBC pg_description update needed for CVS tip
Date: 2001-08-10 20:08:50
Message-ID: 4484.997474130@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-jdbc pgsql-patches

Would some JDBC hacker develop a patch for the following issue? The
change is just barely large enough that I don't want to commit untested
code for it --- but not having a Java development environment at hand,
I can't test the updated code.

The problem is in DatabaseMetaData.java (same code in both jdbc1 and
jdbc2, looks like). It does direct access to pg_description that isn't
right anymore. In getTables, instead of

java.sql.ResultSet dr = connection.ExecSQL("select description from pg_description where objoid="+r.getInt(2));

it should be

java.sql.ResultSet dr = connection.ExecSQL("select obj_description("+r.getInt(2)+",'pg_class')");

In getColumns, the change is a little more involved, because
pg_attribute doesn't have an OID column anymore. The initial query
can't fetch a.oid, but should fetch a.attrelid instead, and then the
pg_description query should become

java.sql.ResultSet dr = connection.ExecSQL("select col_description("+r.getInt(1)+","+r.getInt(5)+")");

(col_description takes the table OID and the column's attnum).

The reason this is more than a 3-line change is that it should be done
either the old way or the new way depending on whether server version >=
7.2 or not, for backwards-compatibility of the driver.

It's possible there are other similar changes needed that I missed in a
quick lookover.

So, would some enterprising person fix the JDBC code to work with CVS
tip, and submit a patch?

thanks, tom lane

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2001-08-10 20:19:24 Portal destination issue: binary vs normal cursors
Previous Message Tom Lane 2001-08-10 18:02:22 Re: KSQO parameter

Browse pgsql-jdbc by date

  From Date Subject
Next Message Rene Pijlman 2001-08-10 23:13:34 Re: DatabaseMetaData
Previous Message Joseph Shraibman 2001-08-10 19:26:41 Re: NullPointerException on next()

Browse pgsql-patches by date

  From Date Subject
Next Message Ian Lance Taylor 2001-08-10 20:41:47 Support building in a different directory on Solaris
Previous Message Bruce Momjian 2001-08-10 18:29:01 Re: JDBC Array Support, Take 2