Re: INSERT WHERE NOT EXISTS

From: "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com>
To: Ian Barwick <barwick(at)gmx(dot)net>
Cc: Mike Mascari <mascarm(at)mascari(dot)com>, <techlist(at)voyager(dot)phys(dot)utk(dot)edu>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: INSERT WHERE NOT EXISTS
Date: 2003-06-25 20:10:03
Message-ID: Pine.LNX.4.33.0306251409450.31359-100000@css120.ihs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 25 Jun 2003, Ian Barwick wrote:

> On Wednesday 25 June 2003 21:37, Mike Mascari wrote:
> > Ian Barwick wrote:
> > > On Wednesday 25 June 2003 20:06, Reuben D. Budiardja wrote:
>
> (...)
> > > This kind of query should work; just leave out the "FROM dummy_table"
> > > bit. (in Oracle it would be "FROM dual").
> >
> > I proposed that same solution 3 years ago. Tom shoots it down:
> >
> > http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=3A4D611
> >6.1A613402%40mascari.com&rnum=1&prev=/groups%3Fq%3DMike%2BMascari%2BINSERT%2
> >BNOT%2BEXISTS%26ie%3DUTF-8%26oe%3DUTF-8%26hl%3Den
> >
> > Reuben must be prepared for unique key violation, I'm afraid. And,
> > despite the optimism in the link, we still don't have savepoints. :-(
>
> aha, useful to know. Thanks.

Oh yeah, in my example you need to do a select for update to be race safe.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2003-06-25 20:11:30 Re: Many Pl/PgSQL parameters -> AllocSetAlloc(128)?
Previous Message Bruce Momjian 2003-06-25 20:08:22 Re: Inherits tables and current CVS