Skip site navigation (1) Skip section navigation (2)

Re: Wrong column names in ResultSetMetaData

From: "Mike Martin" <mmartin(at)vieo(dot)com>
To: "Kris Jurka" <books(at)ejurka(dot)com>
Cc: <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Wrong column names in ResultSetMetaData
Date: 2004-08-04 22:58:32
Message-ID: 002101c47a76$90a77640$fe0f010a@MMARTIN1 (view raw or flat)
Thread:
Lists: pgsql-jdbc
Kris wrote:
> On Tue, 3 Aug 2004, Mike Martin wrote:
>
> > 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!
>
> You seem surprised that it would return an empty string, while that was
> what I was planning on making it do.  Why should it return the base table
> name when it can't determine if it has been aliased?  Isn't this returning
> incorrect information?

You're right, that exclamation point is undeserved.

Based on the description of getTableName() (and getSchemaName()
and getCatalogName()) I would think a driver should either
return the correct information or "" if not available.

Mike


In response to

Responses

pgsql-jdbc by date

Next:From: Dave CramerDate: 2004-08-05 01:22:59
Subject: Re: [HACKERS] postgres and Jdbc 2.0
Previous:From: Oliver JowettDate: 2004-08-04 22:49:07
Subject: Re: [HACKERS] postgres and Jdbc 2.0

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group