agora inbox for pgsql-sql@postgresql.org
help / color / mirror / Atom feedFrom: GB Clark <postgres@vsservices.com>
To: pgsql-sql@postgresql.org
Date: Fri, 15 Feb 2002 15:51:07 -0600
Message-ID: <20020215155107.1e405665.postgres@vsservices.com> (raw)
In-Reply-To: <20020215104908.Y37614-100000@megazone23.bigpanda.com>
References: <002101c1b650$18f087a0$0201a8c0@osprey>
<20020215104908.Y37614-100000@megazone23.bigpanda.com>
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 of my 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?
view thread (9+ messages) latest in thread
Message-ID: <20020215155107.1e405665.postgres@vsservices.com>
Permalink: ../20020215155107.1e405665.postgres@vsservices.com/
Also on: postgresql.org/message-id/20020215155107.1e405665.postgres@vsservices.com
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: postgres@vsservices.com
Subject: Re:
In-Reply-To: <20020215155107.1e405665.postgres@vsservices.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox