Re: alias required by standard or PostgreSQL? - Mailing list pgsql-sql

From Tom Lane
Subject Re: alias required by standard or PostgreSQL?
Date
Msg-id 9788.1196662409@sss.pgh.pa.us
Whole thread Raw
In response to alias required by standard or PostgreSQL?  ("Joost Kraaijeveld" <J.Kraaijeveld@Askesis.nl>)
List pgsql-sql
"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>
<derivedcolumn list> <right paren> ] ]             | <derived table> [ AS ] <correlation name>                   [
<leftparen> <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


pgsql-sql by date:

Previous
From: "Joost Kraaijeveld"
Date:
Subject: alias required by standard or PostgreSQL?
Next
From: Achilleas Mantzios
Date:
Subject: Calling functions from within pl/pgsql