Can't SELECT from (INSERT ... RETURNING)

Started by Nico Sabbiover 18 years ago2 messagesgeneral
Jump to latest
#1Nico Sabbi
nsabbi@officinedigitali.it

I thought I could use the output of INSERT...RETURNING as a set of
tuples for a subquery,
but it seems it's not the case:

nb1=# select * from (insert into m(a) values(112) returning a);
ERROR: syntax error at or near "into"
LINE 1: select * from (insert into m(a) values(112) returni...
^

Is this a bug or it's not even supposed to work in theory?
Such a feature would be extremely useful to have.

P.S.
I know it's non-portable, but this is not a problem.

Thanks,

Nico

#2Merlin Moncure
mmoncure@gmail.com
In reply to: Nico Sabbi (#1)
Re: Can't SELECT from (INSERT ... RETURNING)

On 7/18/07, Nico Sabbi <nsabbi@officinedigitali.it> wrote:

I thought I could use the output of INSERT...RETURNING as a set of
tuples for a subquery,
but it seems it's not the case:

nb1=# select * from (insert into m(a) values(112) returning a);
ERROR: syntax error at or near "into"
LINE 1: select * from (insert into m(a) values(112) returni...
^

Is this a bug or it's not even supposed to work in theory?
Such a feature would be extremely useful to have.

it's on the TODO. It's a frequently requested feature. It's more
complicated than it looks on the surface.

merlin