Re: Wrong column names in ResultSetMetaData - Mailing list pgsql-jdbc

From Mike Martin
Subject Re: Wrong column names in ResultSetMetaData
Date
Msg-id ceofog$15o1$1@news.hub.org
Whole thread Raw
In response to Re: Wrong column names in ResultSetMetaData  ("Mike Martin" <mmartin@vieo.com>)
Responses Re: Wrong column names in ResultSetMetaData
List pgsql-jdbc
Kris Jurka:
> I believe we agree that for consistency's sake we should return the table
> alias (if any) in getTableName.  How could we do that, and what would the
> purpose be?

CREATE TABLE person (
    id int4 primary key,
    parent_id int4 references person (id),
    name varchar(50)
)

SELECT * FROM person inner join person parent on person.parent_id =
parent.id

rs.getTableName() distinguishes person.name from parent.name.

In my experience, drivers correctly implement getTableName()
*far* less frequently.  I've never been able to rely on it.

Of the drivers I have handy, only DB2J and MySQL get it right.
Cloudscape, Firebird, hsqldb, mssqlserver, and pg75 all return
the underlying base table name.  JTDS, Oracle, and pg74 all
return empty strings!

Mike



pgsql-jdbc by date:

Previous
From: Kris Jurka
Date:
Subject: Re: Wrong column names in ResultSetMetaData
Next
From: "J. Michael Crawford"
Date:
Subject: JDBC Latin1 problem