cannot use result of (insert .. returning)

From: "dvs" <dvs(at)fon(dot)kamchatka(dot)ru>
To: <pgsql-general(at)postgresql(dot)org>
Subject: cannot use result of (insert .. returning)
Date: 2008-05-30 10:11:58
Message-ID: 013d01c8c23d$98594540$0e09a8c0@dvs
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello,

I need to use query like:
select (insert into test (a) values (x) returning b),c from anytable
where condition
but it say
ERROR: syntax error at or near "into"

Is this a bug?

Function does not work too:
create function addt(..) returning .. as 'insert ... returning ..'
language 'sql'
ERROR:...
DETAIL: Function's final statement must be a SELECT.

BUT:
create function addt(..) returning .. as
'insert...(nextval('..')...);select currval('..')' language 'sql'
work in
select addt(x),c from anytable where condition

but this function is analog of "insert...returning" in any case
Why analog work "better" then original?
What is my mistake? (I dont want use functions here!)

dvs

Responses

Browse pgsql-general by date

  From Date Subject
Next Message A B 2008-05-30 12:49:20 Connection problem
Previous Message David Harel 2008-05-30 09:25:07 Collate problem when using ORDER BY