Re: A question about PL/pgSQL

From: "K Parker" <kparker(at)eudoramail(dot)com>
To: pgsql-general(at)hub(dot)org
Subject: Re: A question about PL/pgSQL
Date: 2000-10-30 06:32:21
Message-ID: FBKOCEMBHJDHBAAA@shared1-mail.whowhere.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Doesn't the following allow a race condition?

>declare foo record;
>begin
> select into foo * from overview...
> if not found
> insert...
> else ...
> end if;
>end;

ISTM 2 or more clients could attempt to insert the same row, based on the select failing, if all were issued at the same time. I've always assumed that, there being no row to lock in a _failed_ search, even saying SELECT ... FOR UPDATE in this case is no help.

Join 18 million Eudora users by signing up for a free Eudora Web-Mail account at http://www.eudoramail.com

Browse pgsql-general by date

  From Date Subject
Next Message Keith L. Musser 2000-10-30 10:36:48 Re: SQL question - problem with INTERSECT
Previous Message Stephan Szabo 2000-10-29 23:56:42 Re: Raw Newbie: Can't start PGSQL