Capture insert returning

From: scorpdaddy(at)hotmail(dot)com <scorpdaddy(at)hotmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Capture insert returning
Date: 2011-04-08 14:18:21
Message-ID: BLU0-SMTP60973B8169016D96D718D0CEA70@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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.

Browse pgsql-sql by date

  From Date Subject
Next Message Anish Kejariwal 2011-04-12 17:08:25 pass in array to function for use by where clause? how optimize?
Previous Message msi77 2011-04-08 10:21:02 Re: Aggregates puzzle