pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: scorpdaddy@hotmail.com <scorpdaddy@hotmail.com>
To: pgsql-sql@postgresql.org
Subject: Capture insert returning
Date: Fri, 8 Apr 2011 11:18:21 -0300
Message-ID: <BLU0-SMTP60973B8169016D96D718D0CEA70@phx.gbl> (raw)



Considering jdbc to pg8.4, is there a way to save results of "INSERT ... RETURNING *" to a temp table within the transaction, knowing that INSERT RETURNING is a pg specific augmentation to standard SQL.


This doesn't seem to work:


CREATE TEMP TABLE bar ON COMMIT DROP AS

INSERT INTO foo(a, b)

SELECT a, b FROM another_foo

RETURNING *;


The idea is to capture foo's pk, a, b in bar.


Message-ID: <BLU0-SMTP60973B8169016D96D718D0CEA70@phx.gbl>
Permalink:  ../BLU0-SMTP60973B8169016D96D718D0CEA70@phx.gbl/
Also on:    postgresql.org/message-id/BLU0-SMTP60973B8169016D96D718D0CEA70@phx.gbl

 · 

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: scorpdaddy@hotmail.com
  Subject: Re: Capture insert returning
  In-Reply-To: <BLU0-SMTP60973B8169016D96D718D0CEA70@phx.gbl>

* 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