pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: chrisj <chrisj.wood@sympatico.ca>
To: pgsql-sql@postgresql.org
Subject: can a insert with a returning clause be subquery ?
Date: Sat, 2 Feb 2008 15:22:10 -0800 (PST)
Message-ID: <15248628.post@talk.nabble.com> (raw)


I am trying to accomplish this:

update p2user.party set ADDR_KEY =
    (insert into p2user.address ( street_no, street_name)
                        values ('22', 'Geek St.')
       returning addr_key )
 where party_key = 22 ;

But I am getting error:
ERROR:  syntax error at or near "into"
LINE 1: update p2user.party set ADDR_KEY = (insert into p2user.addre...
                                                   ^(is actually under the
"into")

The insert by itself works fine and returns a valid integer.

I know I could do this easily with a stored proc,
 but it seems like an obvious use of the returning clause

Am I missing some syntax error


-- 
View this message in context: http://www.nabble.com/can-a-insert-with-a-returning-clause-be-subquery---tp15248628p15248628.html
Sent from the PostgreSQL - sql mailing list archive at Nabble.com.




view thread (4+ messages)  latest in thread

Message-ID: <15248628.post@talk.nabble.com>
Permalink:  ../15248628.post@talk.nabble.com/
Also on:    postgresql.org/message-id/15248628.post@talk.nabble.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: chrisj.wood@sympatico.ca
  Subject: Re: can a insert with a returning clause be subquery ?
  In-Reply-To: <15248628.post@talk.nabble.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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