Hi David,
I am not sure the RETURNING offers you the following behavior ..
What I'm looking for
+--+-+
| original_rid | rid |
+--+-+
| 1| 4 |
| 2| 5 |
| 3| 6 |
Maybe:
Where newvals AS ()
, insertval AS (insert...select...from newvals) #NO RETURNING
Select * from newvals
I believe the insertval CTE is guaranteed to run even if not directly involved
with the main select statement.
David J.
On Sep 8, 2012, at 2:33, dinesh kumar dineshkuma...@gmail.com
You can make function what returns integer and has input parametars as
other columns of the table:
INSERT INTO testing (category, name, fk_parent) (input parameters)
returning rid
Then SELECT rid as OriginalId, make_copy(other columns) as new_rid From
testing
Kind Regards,
Misa
On Friday,
From: pgsql-general-ow...@postgresql.org
[mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Michael Sacket
Sent: Friday, September 07, 2012 2:09 PM
To: PG-General Mailing List
Subject: [GENERAL] INSERT. RETURNING for copying records
Good Afternoon,
I'm attempting to write a