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: 36e682920802241343u3ce292f5v7e299a9f551a042e@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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:

Yeah...

> 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
projects.

--
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 | http://www.enterprisedb.com/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2008-02-24 22:44:52 Re: insert ... delete ... returning ... ?
Previous Message Guillaume Smet 2008-02-24 21:43:29 Re: insert ... delete ... returning ... ?