Skip site navigation (1) Skip section navigation (2)

cannot use result of (insert..returning)

From: "dvs" <dvs(at)fon(dot)kamchatka(dot)ru>
To: <pgsql-hackers(at)postgresql(dot)org>
Subject: cannot use result of (insert..returning)
Date: 2008-06-04 05:25:11
Message-ID: 006e01c8c603$5ca703b0$0e09a8c0@dvs (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers

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'
DETAIL: Function's final statement must be a SELECT.

   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!)



pgsql-hackers by date

Next:From: Markus SchiltknechtDate: 2008-06-04 07:24:20
Subject: Re: Core team statement on replication in PostgreSQL
Previous:From: Euler Taveira de OliveiraDate: 2008-06-04 04:49:22
Subject: Re: rfc: add pg_dump options to dump output

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group