Re: Wrong column names in ResultSetMetaData

From: "Mike Martin" <mmartin(at)vieo(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Wrong column names in ResultSetMetaData
Date: 2004-08-02 16:32:54
Message-ID: celqa5$i2c$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Oliver Jowett wrote:
> Mike Martin wrote:
> > For programmatic purposes the column name concept is pretty
> > well defined by the docs on ResultSet.
>
> Can you point me to these docs? I can't see this requirement from a
> glance through the 1.4 javadoc, but the JDBC javadoc is pretty useless..

From the ResultSet Javadoc:

"The column name option is designed to be used when column
names are used in the SQL query that generated the result set.
For columns that are NOT explicitly named in the query, it
is best to use column numbers."

The only way to "name" a SQL query column is with AS. There's
corroboration in DatabaseMetaData:

public boolean supportsColumnAliasing() throws SQLException

Retrieves whether this database supports column aliasing.
If so, the SQL AS clause can be used to provide names for
computed columns or to provide alias names for columns as
required.

In both cases, "names" and not "labels".

I too wish the docs were more definitive on this. Googling on
the topic reveals that there has been confusion on it for some
time. Anyone know someone at Sun who could confirm the true
intent?

Mike

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kris Jurka 2004-08-02 18:20:24 Re: Wrong column names in ResultSetMetaData
Previous Message Oliver Jowett 2004-08-02 13:12:44 Re: Unknown Response Type 1