Re: A question about PL/pgSQL - Mailing list pgsql-general

From K Parker
Subject Re: A question about PL/pgSQL
Date
Msg-id FBKOCEMBHJDHBAAA@shared1-mail.whowhere.com
Whole thread Raw
In response to A question about PL/pgSQL  (Warren Vanichuk <pyber@street-light.com>)
List 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
sametime.  I've always assumed that, there being no row to lock in a _failed_ search, even saying SELECT ... FOR UPDATE
inthis case is no help. 


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

pgsql-general by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: Raw Newbie: Can't start PGSQL
Next
From: "Sergei O . Naumov"
Date:
Subject: Help in chosing Db: hierarchical data in tables