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

From Mike Martin
Subject Re: Wrong column names in ResultSetMetaData
Date
Msg-id cemi1o$2bur$1@news.hub.org
Whole thread Raw
In response to Re: Wrong column names in ResultSetMetaData  ("Mike Martin" <mmartin@vieo.com>)
List pgsql-jdbc
Oliver Jowett wrote:
> > 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".
>
> Is an "alias name" the same as a "column name"?

In SQL, yes.  A result column has a name, and the AS clause is
the way to reassign that name.

Try this on your favorite DBMS:

    SELECT COL FROM (SELECT COL AS FOO FROM T) T1

It fails because the parenthesized query result has no column
named COL.

Mike



pgsql-jdbc by date:

Previous
From: "Mike Martin"
Date:
Subject: Re: Wrong column names in ResultSetMetaData
Next
From: Oliver Jowett
Date:
Subject: Re: Wrong column names in ResultSetMetaData