... - Mailing list pgsql-sql

From GB Clark
Subject ...
Date
Msg-id 20020215155107.1e405665.postgres@vsservices.com
Whole thread Raw
In response to Re: Problem with self-join updates...  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Responses Sorry about the no subject message...  (GB Clark <postgres@vsservices.com>)
List pgsql-sql
Hi,

Can anyone give me a couple of examples or a explanation of select for update is supposed to work?

I've looked in the manual and the locking stuff is confusing (or it could just be me not understanding..))and neither
ofmy SQL books go into any type of detail on locking.
 

What I want to do is select a record, do something and then update that record to reflect the outcome
of the processing with 0% chance of another process doing the same thing.  Is this possiable?

my idea:

BEGIN
SELECT * FROM table1 WHERE record_id = '290202' FOR UPDATE
-- Do processing here
UPDATE table1 SET flag1 = '11' WHERE record_id = '290202'
COMMIT

Just looking for more information....

Thanks,

GB

-- 
GB Clark II             | Roaming FreeBSD Admin
gclarkii@VSServices.COM | General Geek           CTHULU for President - Why choose the lesser of two evils?


pgsql-sql by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: Problem with self-join updates...
Next
From: GB Clark
Date:
Subject: Sorry about the no subject message...