alias required by standard or PostgreSQL?

Поиск
Список
Период
Сортировка
Искать

alias required by standard or PostgreSQL?

От:
"Joost Kraaijeveld" <J.Kraaijeveld@Askesis.nl>
Дата:
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


Re: alias required by standard or PostgreSQL?

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
"Joost Kraaijeveld"  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
         ::=               
[ [ AS ] [ ] ] | [ AS ] [ ] | ::=
Note that the brackets show that a (ie, an alias) is optional for a regular table, but not for a subquery. regards, tom lane
FAQ