pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mike Martin <mmartin@vieo.com>
To: pgsql-jdbc@postgresql.org
Subject: Re: Wrong column names in ResultSetMetaData
Date: Mon, 2 Aug 2004 18:16:46 -0500
Message-ID: <cemi1o$2bur$1@news.hub.org> (raw)
References: <ce9dna$pne$1@news.hub.org>
	<ce9jk0$15mb$1@news.hub.org>
	<41086EF8.7010101@opencloud.com>
	<celqa5$i2c$1@news.hub.org>
	<410EC364.8090004@opencloud.com>

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





view thread (27+ messages)  latest in thread

Message-ID: <cemi1o$2bur$1@news.hub.org>
Permalink:  ../cemi1o$2bur$1@news.hub.org/
Also on:    postgresql.org/message-id/cemi1o$2bur$1@news.hub.org

 · 

reply

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: mmartin@vieo.com
  Subject: Re: Wrong column names in ResultSetMetaData
  In-Reply-To: <cemi1o$2bur$1@news.hub.org>
  References: <ce9dna$pne$1@news.hub.org> <ce9jk0$15mb$1@news.hub.org> <41086EF8.7010101@opencloud.com> <celqa5$i2c$1@news.hub.org> <410EC364.8090004@opencloud.com> <cemi1o$2bur$1@news.hub.org>

* 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