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

From Rene Pijlman
Subject Re: JDBC pg_description update needed for CVS tip
Date
Msg-id 6a0ento77m7mrf5c0i8njd4adtdrahn9s2@4ax.com
Whole thread Raw
In response to JDBC pg_description update needed for CVS tip  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: JDBC pg_description update needed for CVS tip
List pgsql-jdbc
On Fri, 10 Aug 2001 16:08:50 -0400, you wrote:
>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')");

Done that (columns to). When testing I noticed a difference
between 7.1 and 7.2: when there is no comment on a table or
column, 7.1 returns the string "no remarks" in the REMARKS
column of the ResultSet from getTables()/getColumns(), whereas
7.2 returns null.

So it appears that your new statement that uses
obj_description() and col_description() returns one row with a
null when there is no comment, instead of 0 rows. Is this
intentional?

The JDBC spec says: "String object containing an explanatory
comment on the table/column, which may be null". So actually,
this new behaviour is closer to the standard than the old
behaviour and I'm inclined to leave it this way. In fact, I
might as well remove the defaultRemarks code from
DatabaseMetaData.java.

This might break existing code that doesn't follow the JDBC spec
and isn't prepared to handle a null in the REMARKS column of
getTables()/getColumns().

Regards,
René Pijlman

pgsql-jdbc by date:

Previous
From: Tom Lane
Date:
Subject: Re: JDBC pg_description update needed for CVS tip
Next
From: Tom Lane
Date:
Subject: Re: JDBC pg_description update needed for CVS tip