Re: ResultSetMetaData.getTableName() == null - Mailing list pgsql-jdbc

From Philip Yarra
Subject Re: ResultSetMetaData.getTableName() == null
Date
Msg-id 45137CF4.7030202@utiba.com
Whole thread Raw
In response to Re: ResultSetMetaData.getTableName() == null  (Oliver Jowett <oliver@opencloud.com>)
List pgsql-jdbc
Oliver Jowett wrote:
> Philip Yarra wrote:
> So your suggested implementation would return incorrect information
> whenever there were aliases involved.

Thanks, I understand now. So the decision was to return nothing, rather
than something that's potentially wrong?

> We have no way of telling if aliasing has been done or not based on the
> data returned by the server, so we can't even do it only when no aliases
> are used.

Looks like Sybase came to the same question and decided that returning
the base table name was ok:

$ java -cp .:/home/philip/bin/jconn3.jar rsmd sybase3.prop
2006-09-22T15:50:39.206:QUERY: SELECT * FROM tempextest
2006-09-22T15:50:39.210:table name [tempextest]
2006-09-22T15:50:39.212:QUERY: SELECT * FROM tempextest tablealias
2006-09-22T15:50:39.215:table name [tempextest]

Oracle seems to have a very similar implementation to PostgreSQL:

$ java -cp .:/home/philip/bin/ojdbc14.jar rsmd oracle.prop
2006-09-22T15:53:59.882:QUERY: SELECT * FROM tempextest
2006-09-22T15:53:59.986:empty table name
2006-09-22T15:53:59.987:table name []
2006-09-22T15:53:59.989:QUERY: SELECT * FROM tempextest tablealias
2006-09-22T15:54:00.3:empty table name
2006-09-22T15:54:00.4:table name []

How about allowing the user to set a connection property so that the
(possibly-wrong-but-more-useful) call through to getbaseTablename is
done, so that *some* info comes back, with default of existing
behaviour? Or has that also been discussed and dismissed previously? :-)

Regards, Philip.

--
Philip Yarra
Senior Software Engineer, Utiba Pty Ltd
philip@utiba.com

pgsql-jdbc by date:

Previous
From: Oliver Jowett
Date:
Subject: Re: ResultSetMetaData.getTableName() == null
Next
From: Alex Stienstra
Date:
Subject: Re: ResultSetMetaData.getTableName() == null