Re: Select for insert possible?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Lincoln Yeoh <lyeoh(at)pop(dot)jaring(dot)my>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Select for insert possible?
Date: 2001-03-25 16:28:27
Message-ID: 11210.985537707@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Lincoln Yeoh <lyeoh(at)pop(dot)jaring(dot)my> writes:
> So I'll use "lock table" (this time in exclusive mode :) ), then select for
> update, then insert|update and leave the unique index to trigger an error
> when I forget to all that correctly, in which case it's definitely an error.

If you're holding an exclusive-mode lock then there's no need to do the
select FOR UPDATE; there can be no other lock holder.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Boris 2001-03-25 16:30:40 Some interesting errorcodes (FreeBSD) PG 7.1 from cvs
Previous Message Glenn 2001-03-25 16:05:24 How to Cache Database?