Re: Wrong column names in ResultSetMetaData

From: "Mike Martin" <mmartin(at)vieo(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Wrong column names in ResultSetMetaData
Date: 2004-08-03 16:48:30
Message-ID: ceofog$15o1$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Oliver Jowett 2004-08-04 06:37:05 Re: [JDBC] Very strange Error in Updates
Previous Message Kris Jurka 2004-08-03 06:00:08 Re: Wrong column names in ResultSetMetaData