pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #13273: A query that returns wrongly labeled result instead of syntax error
3+ messages / 3 participants
[nested] [flat]
* BUG #13273: A query that returns wrongly labeled result instead of syntax error
@ 2015-05-11 22:46 v-brody@seznam.cz
0 siblings, 1 reply; 3+ messages in thread
From: v-brody@seznam.cz @ 2015-05-11 22:46 UTC (permalink / raw)
To: pgsql-bugs
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
Environment:
PostgreSQL 9.4.1 on Linux version 2.6.32-504.16.2.el6.x86_64
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: BUG #13273: A query that returns wrongly labeled result instead of syntax error
@ 2015-05-12 04:17 Thomas Munro <thomas.munro@enterprisedb.com>
parent: v-brody@seznam.cz
0 siblings, 1 reply; 3+ messages in thread
From: Thomas Munro @ 2015-05-12 04:17 UTC (permalink / raw)
To: v-brody@seznam.cz; +Cc: 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
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: BUG #13273: A query that returns wrongly labeled result instead of syntax error
@ 2015-05-12 08:19 Václav Brodec <v-brody@seznam.cz>
parent: Thomas Munro <thomas.munro@enterprisedb.com>
0 siblings, 0 replies; 3+ messages in thread
From: Václav Brodec @ 2015-05-12 08:19 UTC (permalink / raw)
To: Thomas Munro <thomas.munro@enterprisedb.com>; +Cc: pgsql-bugs
Thomas Munro writes:
> 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)
>
I'm really sorry, I realized that immediately after submitting.
Although I think that demanding explicit AS in this case (when
overshadowing some name) might be useful. :-)
Thank you for your time,
Václav Brodec
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2015-05-12 08:19 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2015-05-11 22:46 BUG #13273: A query that returns wrongly labeled result instead of syntax error v-brody@seznam.cz
2015-05-12 04:17 ` Thomas Munro <thomas.munro@enterprisedb.com>
2015-05-12 08:19 ` Václav Brodec <v-brody@seznam.cz>
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