Re: BUG #13273: A query that returns wrongly labeled result instead of syntax error

Поиск
Список
Период
Сортировка
От Thomas Munro
Тема Re: BUG #13273: A query that returns wrongly labeled result instead of syntax error
Дата
Msg-id CAEepm=1qfYkwg2wUz3wV7Bx+qkfZbd--7-LYyVduEUvZ_mQ7sQ@mail.gmail.com
обсуждение исходный текст
Ответ на BUG #13273: A query that returns wrongly labeled result instead of syntax error  (v-brody@seznam.cz)
Ответы Re: BUG #13273: A query that returns wrongly labeled result instead of syntax error  (Václav Brodec <v-brody@seznam.cz>)
Список pgsql-bugs
On Tue, May 12, 2015 at 10:46 AM,  <v-brody@seznam.cz> wrote:
> The following bug has been logged on the website:
>
> Bug reference:      13273
> Logged by:          Missing comma in SELECT list results in wrong label without error
> Email address:      v-brody@seznam.cz
> PostgreSQL version: 9.4.1
> Operating system:   CentOS Linux
> Description:
>
> Following query (notice the missing comma between top-level "x" and "y")
> returns 1 (which is "x" value) under label "y" without any warning.
>
> select
>     "x" "y"
> from
> (
>     select
>         "a" as "x", "b" as "y"
>     from
>     (
>         select 1 as "a", 2 as "b"
>     ) "subquery1"
> ) "subquery2";
>
> Expected behavior: syntax error

That is valid syntax, the AS keyword is optional (in PostgreSQL as
well as in standard SQL):

http://www.postgresql.org/docs/9.4/static/sql-select.html

postgres=# select 42 as y;
 y
----
 42
(1 row)

postgres=# select 42 y;
 y
----
 42
(1 row)

--
Thomas Munro
http://www.enterprisedb.com

В списке pgsql-bugs по дате отправления:

Предыдущее
От: v-brody@seznam.cz
Дата:
Сообщение: BUG #13273: A query that returns wrongly labeled result instead of syntax error
Следующее
От: Václav Brodec
Дата:
Сообщение: Re: BUG #13273: A query that returns wrongly labeled result instead of syntax error