From: | snpe <snpe(at)snpe(dot)co(dot)yu> |
---|---|
To: | <pgsql-jdbc(at)postgresql(dot)org> |
Subject: | Re: DatabaseMetaData.getTables problem |
Date: | 2002-11-08 22:21:57 |
Message-ID: | 200211082221.58133.snpe@snpe.co.yu |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
Kris explain good.
I don't know that you need regression test, but this is command :
Connection con = DriverManager.getConnection (....);
DatabaseMetaData db = con.getMetaData();
ResultSet rs =db.getTables(null,null,"any_table",null);
If ResultSet get one row for catalog,shema that is ok.
regards
Haris Peco
On Friday 08 November 2002 06:34 pm, Kris Jurka wrote:
> The problem is that the join to retrieve the table's comment from
> pg_description is not properly constrained. A table's comment is
> stored in pg_description with the objoid of the table's pg_class
> oid and objsubid = 0. A table's column's comments are stored with the
> table's pg_class oid and objsubid of pg_attribute.attnum. If any column
> in the table has a comment then the query will not work properly
> (retrieving extra rows).
>
> Kris Jurka
>
> On Fri, 8 Nov 2002, Barry Lind wrote:
> > Can you also submit a test case? I would like to add a regression test
> > that tests for the problem being fixed here. (which I don't understand
> > entirely)
> >
> > thanks,
> > --Barry
> >
> > snpe wrote:
> > > Hello,
> > > I am playing with DatabaseMetaData.getTables
> > > I call getTables(null,null,"TABELA",null)
> > >
> > > ResultSet get (number of column of TABELA)+ 1 rows
> > >
> > > Patch for this problem is :
> > > ---
> > > /u2/postgrescvs/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Abstract
> > >Jdbc1DatabaseMetaData.java 2002-11-04 12:03:04.000000000 +0000
> > > +++ org/postgresql/jdbc1/AbstractJdbc1DatabaseMetaData.java 2002-11-07
> > > 22:11:11.000000000 +0000
> > > @@ -1988,7 +1988,7 @@
> > > " END "+
> > > " AS TABLE_TYPE, d.description AS REMARKS "+
> > > " FROM pg_catalog.pg_namespace n, pg_catalog.pg_class c "+
> > > - " LEFT JOIN pg_catalog.pg_description d ON (c.oid = d.objoid) "+
> > > + " LEFT JOIN pg_catalog.pg_description d ON (c.oid = d.objoid and
> > > d.objsubid = 0) "+
> > > " LEFT JOIN pg_catalog.pg_class dc ON (d.classoid=dc.oid AND
> > > dc.relname='pg_class') "+
> > > " LEFT JOIN pg_catalog.pg_namespace dn ON (dn.oid=dc.relnamespace
> > > AND dn.nspname='pg_catalog') "+
> > > " WHERE c.relnamespace = n.oid ";
> > >
> > >
> > > ---------------------------(end of
> > > broadcast)--------------------------- TIP 2: you can get off all lists
> > > at once with the unregister command (send "unregister
> > > YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 2: you can get off all lists at once with the unregister command
> > (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
From | Date | Subject | |
---|---|---|---|
Next Message | snpe | 2002-11-09 17:51:41 | PostgreSQL JDBC and sub-select |
Previous Message | Dave Cramer | 2002-11-08 20:20:18 | Re: idle processes - pg_recvbuf |