Re: ResultSetMetaData.getTableName() == null

From: Philip Yarra <philip(at)utiba(dot)com>
To: Oliver Jowett <oliver(at)opencloud(dot)com>
Cc: Alex Stienstra <alex(dot)stienstra(at)zonnet(dot)nl>, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: ResultSetMetaData.getTableName() == null
Date: 2006-09-22 06:04:36
Message-ID: 45137CF4.7030202@utiba.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)utiba(dot)com

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Alex Stienstra 2006-09-22 06:49:44 Re: ResultSetMetaData.getTableName() == null
Previous Message Oliver Jowett 2006-09-22 05:40:18 Re: ResultSetMetaData.getTableName() == null