Skip site navigation (1) Skip section navigation (2)

Re: [HACKERS] JDBC pg_description update needed for CVS

From: Jeroen van Vianen <jeroen(dot)van(dot)vianen(at)satama(dot)com>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: [HACKERS] JDBC pg_description update needed for CVS
Date: 2001-09-07 14:45:57
Message-ID: 5.1.0.14.2.20010907163902.00a864c8@ams010.satama.com (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-jdbcpgsql-patches
At 00:30 9/7/2001 -0400, Bruce Momjian wrote:
>Can someone tackles this and supply a patch?

This has been addressed in the patch that was recently committed for JDBC's 
broken getColumn() support. As I'm using outer joins and was unable to come 
up with SQL syntax that would correctly use an outer join with a function 
returning a single row (col_description), I used the actual function 
definition for col_description for >= 7.2 servers. For details see my mail 
at http://fts.postgresql.org/db/mw/msg.html?mid=1032468

OTOH, I haven't touched JDBC's getTable() code.

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

Cheers,


Jeroen


In response to

pgsql-hackers by date

Next:From: Karel ZakDate: 2001-09-07 14:58:26
Subject: Re: Beta Monday?
Previous:From: matthew.copelandDate: 2001-09-07 14:40:53
Subject: Re: Conditional NOTIFY is not implemented

pgsql-patches by date

Next:From: Liam StewartDate: 2001-09-07 14:54:18
Subject: Re: multiple inserts
Previous:From: Bruce MomjianDate: 2001-09-07 14:31:29
Subject: Re: JDBC patch procedures (Re: [PATCHES] Patch for jdbc2 ResultSet.java)

pgsql-jdbc by date

Next:From: Rene PijlmanDate: 2001-09-07 15:56:59
Subject: Fix set/get transaction isolation level test in ConnectionTest
Previous:From: Bruce MomjianDate: 2001-09-07 14:31:29
Subject: Re: JDBC patch procedures (Re: [PATCHES] Patch for jdbc2 ResultSet.java)

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group