Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 530F92E2D79 for ; Sat, 2 Feb 2008 19:22:16 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 28583-08 for ; Sat, 2 Feb 2008 19:22:12 -0400 (AST) Received: from kuber.nabble.com (kuber.nabble.com [216.139.236.158]) by postgresql.org (Postfix) with ESMTP id 75AFA2E1BF9 for ; Sat, 2 Feb 2008 19:22:12 -0400 (AST) Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1JLRgY-0006pD-OC for pgsql-sql@postgresql.org; Sat, 02 Feb 2008 15:22:10 -0800 Message-ID: <15248628.post@talk.nabble.com> Date: Sat, 2 Feb 2008 15:22:10 -0800 (PST) From: chrisj To: pgsql-sql@postgresql.org Subject: can a insert with a returning clause be subquery ? MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: chrisj.wood@sympatico.ca X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.685 tagged_above=0 required=5 tests=AWL=-0.204, BAYES_20=-0.74, DNS_FROM_OPENWHOIS=1.13, WHOIS_MYPRIVREG=1.499 X-Spam-Level: * X-Archive-Number: 200802/4 X-Sequence-Number: 30095 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.