Thread: DatabaseMetaData.getCrossReference(...)

DatabaseMetaData.getCrossReference(...)

From
Friedrich Schaeuffelhut
Date:
Hi

I have a litte problem with the Postgres 7.3.2 jdbc driver:
File: org/postgresql/jdbc1/AbstractJdbc1DatabaseMetaData.java

The function DatabaseMetaData.getCrossReference(..) provides information
about how tables reference each other. Thereby there is a field fk_name
which should contain the name of the foreign key. But the value of this
field is "fk_name\000..\000..". While crawling through the source I
discovered that the retuned value is taken from the column pg_trigger.tgargs
instead of pg_trigger.tgconstrname.

Further more I saw, that the field pg_trigger.tgconstrname is selected and
in  Line 3061 fKeyName is retrieved from the resultset, but never used again:

L3061:  String fKeyName = rs.getString(5);

In Line 3140 targs.getBytes() is then assigned to the return tuple:

L3140: tuple[11] = targs.getBytes(); //FK_NAME this will give us a
                                     //unique name for the foreign key

Is there any reason for this, besides to be shure the name is unique?
I just need the constraint name not an other unique name.
I tested the behaviour of an Informix JDBC driver and got just the
constraint name.

Thank you

    Friedrich

--
                                            _
Friedrich Schäuffelhut                     | |_   _ _
e-mail: fries@desert.lnp.org               | | '\| '_\ LNP is a
                                           |_|_|_| '_/ Network Project
                                                 |_|


Re: DatabaseMetaData.getCrossReference(...)

From
Kris Jurka
Date:

On Thu, 3 Apr 2003, Friedrich Schaeuffelhut wrote:

> The function DatabaseMetaData.getCrossReference(..) provides information
> about how tables reference each other. Thereby there is a field fk_name
> which should contain the name of the foreign key. But the value of this
> field is "fk_name\000..\000..".

This has already been fixed in the cvs version of the driver.

Kris Jurka