From: Thomas Dudziak <tomdzk@gmail.com>
To: pgsql-jdbc@postgresql.org
Subject: Re: Missing functionality in ResultSetMetaData ?
Date: Wed, 10 Aug 2005 01:16:06 +0200
Message-ID: <224f323405080916162cd2f75a@mail.gmail.com> (raw)
In-Reply-To: <Pine.BSO.4.56.0508091748200.13635@leary.csoft.net>
References: <224f323405080913385a38ece0@mail.gmail.com>
<Pine.BSO.4.56.0508091611090.19160@leary.csoft.net>
<224f323405080914194be16ac3@mail.gmail.com>
<Pine.BSO.4.56.0508091659460.32521@leary.csoft.net>
<224f3234050809153725fb91c@mail.gmail.com>
<Pine.BSO.4.56.0508091748200.13635@leary.csoft.net>
On 8/10/05, Kris Jurka <books@ejurka.com> wrote:
> The issue actually started with column names. The pg server currently can
> return aliases for columns, but not for tables. The original complaint
> was that RSMD.getColumnName better match up with something if we call
> ResultSet.findColumn with it. After much discussion it was agreed that
> getColumnName means the name of the query's result column not the base
> table's column. Now, to be consistent getTableName must mean the query's
> table as well.
Ah, ok, I understand this.
> This isn't completely useless, consider a self join: "SELECT a.c,
> b.c FROM tab a, tab b". getBaseTableName cannot distinguish this, but if
> getTableName did return the alias it could. This isn't a real strong
> use case though...
> > "The method PreparedStatement.getMetaData retrieves a
> > ResultSetMetaData object containing a description of the columns that will be
> > returned by a prepared statement when is it executed. The ResultSetMetaData
> > object contains a record for each column being returned. Methods in the
> > ResultSetMetaData interface provide information about the number of columns
> > being returned and the characteristics of each column."
> >
> > Here they specifically speak about the column' characteristics (ie.
> > definition) not the query.
>
> That's not entirely clear. That's how you read it, but it is just as
> easily read as "the query result's columns". The spec is awfully vague in
> this area.
Yep, that's the problem. Interestingly, the Javadoc for RSMD.getCatalogName says
"Gets the designated column's table's catalog name"
where the Javadoc for getTableName says
"Gets the designated column's table name."
So, taken together this could be interpreted as meaning the structural
info (real table). But as you said, this is guess work.
Perhaps you could write a comment to the JDBC4 JSR group and ask for
clarification of the semantics of the RSMD in the new spec ?
regards,
Tom
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: tomdzk@gmail.com
Subject: Re: Missing functionality in ResultSetMetaData ?
In-Reply-To: <224f323405080916162cd2f75a@mail.gmail.com>
References: <224f323405080913385a38ece0@mail.gmail.com> <Pine.BSO.4.56.0508091611090.19160@leary.csoft.net> <224f323405080914194be16ac3@mail.gmail.com> <Pine.BSO.4.56.0508091659460.32521@leary.csoft.net> <224f3234050809153725fb91c@mail.gmail.com> <Pine.BSO.4.56.0508091748200.13635@leary.csoft.net> <224f323405080916162cd2f75a@mail.gmail.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