From: Tom Lane <tgl@sss.pgh.pa.us>
To: Joost Kraaijeveld <J.Kraaijeveld@Askesis.nl>
Cc: pgsql-sql@postgresql.org
Subject: Re: alias required by standard or PostgreSQL?
Date: Mon, 03 Dec 2007 01:13:29 -0500
Message-ID: <9788.1196662409@sss.pgh.pa.us> (raw)
In-Reply-To: <1196661149.5542.33.camel@panoramix.askesis.nl>
References: <1196661149.5542.33.camel@panoramix.askesis.nl>
"Joost Kraaijeveld" <J.Kraaijeveld@Askesis.nl> writes:
> "select * from (select * from table_name)"
> PostgreSQL complains with
> ERROR: subquery in FROM must have an alias
> HINT: For example, FROM (SELECT ...) [AS] foo.
> Is the alias required by the ISO standard
Yes. A FROM-clause entry is defined as
<table reference> ::=
<table name> [ [ AS ] <correlation name>
[ <left paren> <derived column list> <right paren> ] ]
| <derived table> [ AS ] <correlation name>
[ <left paren> <derived column list> <right paren> ]
| <joined table>
<derived table> ::= <table subquery>
Note that the brackets show that a <correlation name> (ie, an alias)
is optional for a regular table, but not for a subquery.
regards, tom lane
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 using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, J.Kraaijeveld@Askesis.nl
Subject: Re: alias required by standard or PostgreSQL?
In-Reply-To: <9788.1196662409@sss.pgh.pa.us>
* 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