From: Oliver Jowett <oliver@opencloud.com>
To: Philip Yarra <philip@utiba.com>
Cc: Alex Stienstra <alex.stienstra@zonnet.nl>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: ResultSetMetaData.getTableName() == null
Date: Fri, 22 Sep 2006 17:40:18 +1200
Message-ID: <45137742.9050600@opencloud.com> (raw)
In-Reply-To: <4513727F.10107@utiba.com>
References: <20060921121816.9wvu8sr34w5c4848@webmail.versatel.nl>
<45133DE5.4030100@utiba.com>
<451354B5.2070701@opencloud.com>
<45135D9B.50500@utiba.com>
<45135EE2.6020507@opencloud.com>
<4513727F.10107@utiba.com>
Philip Yarra wrote:
> so is there
> some reason why getTableName couldn't be re-written as:
>
> public String getTableName(int column) throws SQLException
> {
> return getBaseTableName(column);
> }
>
We came to the conclusion in the original discussion that getTableName()
should return the aliased name of the table in the query, or the actual
table name if not aliased.
getBaseTableName() always returns the real underlying table name, even
if it was actually aliased to something else in the query. This reflects
the information that the server gives us (see the RowDescription message
in
http://www.postgresql.org/docs/8.1/static/protocol-message-formats.html
-- getBaseTableName() returns a name based on the table object ID in
that message)
So your suggested implementation would return incorrect information
whenever there were aliases involved.
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.
-O
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: oliver@opencloud.com, philip@utiba.com, alex.stienstra@zonnet.nl
Subject: Re: ResultSetMetaData.getTableName() == null
In-Reply-To: <45137742.9050600@opencloud.com>
References: <20060921121816.9wvu8sr34w5c4848@webmail.versatel.nl> <45133DE5.4030100@utiba.com> <451354B5.2070701@opencloud.com> <45135D9B.50500@utiba.com> <45135EE2.6020507@opencloud.com> <4513727F.10107@utiba.com> <45137742.9050600@opencloud.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox