pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
alias required by standard or PostgreSQL?
2+ messages / 2 participants
[nested] [flat]

* alias required by standard or PostgreSQL?
@ 2007-12-03 05:52 Joost Kraaijeveld <J.Kraaijeveld@Askesis.nl>
  2007-12-03 06:13 ` Re: alias required by standard or PostgreSQL? Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 2+ messages in thread

From: Joost Kraaijeveld @ 2007-12-03 05:52 UTC (permalink / raw)
  To: pgsql-sql

Hi,

If I run the query 

"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 or is this a PostgreSQL
requirement?

TIA

-- 
Groeten,

Joost Kraaijeveld
Askesis B.V.
Molukkenstraat 14
6524NB Nijmegen
tel: 024-3888063 / 06-51855277
fax: 024-3608416
web: www.askesis.nl




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: alias required by standard or PostgreSQL?
  2007-12-03 05:52 alias required by standard or PostgreSQL? Joost Kraaijeveld <J.Kraaijeveld@Askesis.nl>
@ 2007-12-03 06:13 ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2007-12-03 06:13 UTC (permalink / raw)
  To: Joost Kraaijeveld <J.Kraaijeveld@Askesis.nl>; +Cc: 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> <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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2007-12-03 06:13 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-12-03 05:52 alias required by standard or PostgreSQL? Joost Kraaijeveld <J.Kraaijeveld@Askesis.nl>
2007-12-03 06:13 ` Tom Lane <tgl@sss.pgh.pa.us>

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