Skip site navigation (1) Skip section navigation (2)

Re: insert ... delete ... returning ... ?

From: "Jonah H(dot) Harris" <jonah(dot)harris(at)gmail(dot)com>
To: "Mark Mielke" <mark(at)mark(dot)mielke(dot)cc>
Cc: Postgresql-Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: insert ... delete ... returning ... ?
Date: 2008-02-24 21:43:46
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
On Sun, Feb 24, 2008 at 4:21 PM, Mark Mielke <mark(at)mark(dot)mielke(dot)cc> wrote:
>  I tried using insert ... delete ... return ... and get a syntax error:


>  In the past I've executed insert ... select and then the delete.
>  However, I believe there is race condition here as the delete may see
>  more or less rows than the insert ... select. I thought the above would
>  be a clever PostgreSQL-8.3 alternative, but I'm either stupid or it
>  doesn't work... :-)

Not stupid, it doesn't work :)  This was a limitation of the original
design based on (IIRC) executor-related issues.  I've seen about 6 or
so posts now about using DELETE returning in the same manner as you're
discussing, and I agree it would be quite useful.  Unfortunately, with
the amount of changes required to make it work properly, no one has
wanted to pick that up and add it yet :(

Depending on what else I'm working on, I'd like to get this fixed for
8.4.  Though, I'll probably be working on other, more important

Jonah H. Harris, Sr. Software Architect | phone: 732.331.1324
EnterpriseDB Corporation                | fax: 732.331.1301
499 Thornall Street, 2nd Floor          | jonah(dot)harris(at)enterprisedb(dot)com
Edison, NJ 08837                        |

In response to


pgsql-hackers by date

Next:From: Tom LaneDate: 2008-02-24 22:44:52
Subject: Re: insert ... delete ... returning ... ?
Previous:From: Guillaume SmetDate: 2008-02-24 21:43:29
Subject: Re: insert ... delete ... returning ... ?

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group