Re: Wrong column names in ResultSetMetaData - Mailing list pgsql-jdbc

From Mike Martin
Subject Re: Wrong column names in ResultSetMetaData
Date
Msg-id celqa5$i2c$1@news.hub.org
Whole thread Raw
In response to Re: Wrong column names in ResultSetMetaData  ("Mike Martin" <mmartin@vieo.com>)
Responses Re: Wrong column names in ResultSetMetaData
Re: Wrong column names in ResultSetMetaData
List 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



pgsql-jdbc by date:

Previous
From: Oliver Jowett
Date:
Subject: Re: Unknown Response Type 1
Next
From: Kris Jurka
Date:
Subject: Re: Wrong column names in ResultSetMetaData