potential bug in error message in with clause

Started by Szymon Guzover 12 years ago2 messages
#1Szymon Guz
mabewlun@gmail.com

Hi,
today on IRC there was a strange problem shown. The small working example
looks like this:

x=# with x as (insert into a(t) values('1') returning *) select * from x;
t
---
1
(1 row)

x=# with x (insert into a(t) values('1') returning *) select * from x;
ERROR: syntax error at or near "into"
LINE 1: with x (insert into a(t) values('1') returning *) select * f...
^

The initial code was run on 9.2; I've checked that on 9.4devel.

The error message is really not useful, as there is missing "as" after
"with x". There is no problem with "into".

regards
Szymon

#2Albe Laurenz
laurenz.albe@wien.gv.at
In reply to: Szymon Guz (#1)
Re: potential bug in error message in with clause

Szymon Guz wrote:

today on IRC there was a strange problem shown. The small working example looks like this:

x=# with x as (insert into a(t) values('1') returning *) select * from x;
t
---
1
(1 row)

x=# with x (insert into a(t) values('1') returning *) select * from x;
ERROR: syntax error at or near "into"
LINE 1: with x (insert into a(t) values('1') returning *) select * f...
^

The initial code was run on 9.2; I've checked that on 9.4devel.

The error message is really not useful, as there is missing "as" after "with x". There is no problem
with "into".

I don't think that's a bug.

A parenthesis after with_query_name introduces the list of column
names for the WITH-query, and it complains that there is no comma
or closing parenthesis after "insert".

Yours,
Laurenz Albe

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers