Re: [HACKERS] JDBC pg_description update needed for CVS tip - Mailing list pgsql-jdbc

From Bruce Momjian
Subject Re: [HACKERS] JDBC pg_description update needed for CVS tip
Date
Msg-id 200109070430.f874UO125982@candle.pha.pa.us
Whole thread Raw
In response to JDBC pg_description update needed for CVS tip  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [HACKERS] JDBC pg_description update needed for CVS  (Jeroen van Vianen <jeroen.van.vianen@satama.com>)
List pgsql-jdbc
Can someone tackles this and supply a patch?


> 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
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

pgsql-jdbc by date:

Previous
From: Tom Lane
Date:
Subject: Re: [Fwd: Re: Using char fields with 7.1.3 driver]
Next
From: Barry Lind
Date:
Subject: Re: JDBC patch procedures (Re: [PATCHES] Patch for jdbc2 ResultSet.java)