Re: SQL syntax (column alias)
| От | Tom Lane |
|---|---|
| Тема | Re: SQL syntax (column alias) |
| Дата | |
| Msg-id | 20681.1036950285@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Re: SQL syntax (column alias) (Joe Conway <mail@joeconway.com>) |
| Список | pgsql-hackers |
Joe Conway <mail@joeconway.com> quotes:
> In the SQL92 standard, the optional keyword AS is just noise and can be
> omitted without affecting the meaning. The PostgreSQL parser requires this
> keyword when renaming output columns because the type extensibility features
> lead to parsing ambiguities in this context. AS is optional in FROM items,
> however.
Actually, I think it's not so much datatype extensibility as operator
extensibility, and specifically the fact that we allow postfix
operators. If AS were optional, then
SELECT 1 + x FROM foo;
could be parsed either as "(1 + x)" (infix +, x presumably a column name)
or as "(1 +) x" (postfix +, x an AS-name).
So allowing AS to be optional would at minimum require taking out
postfix operators. There might be other features we'd have to lose,
too; I haven't tried messing with the grammar to see what would happen.
regards, tom lane
В списке pgsql-hackers по дате отправления: