agora inbox for pgsql-sql@postgresql.org
help / color / mirror / Atom feedFrom: Andrew G. Hammond <drew@xyzzy.dhs.org>
To: feblec@ig.com.br
Cc: pgsql-sql@postgresql.org
Subject: Re: SELECT FOR UPDATE
Date: Tue, 12 Mar 2002 12:46:22 -0500
Message-ID: <20020312174622.GB19889@xyzzy.dhs.org> (raw)
In-Reply-To: <20020312012356.35108475965@postgresql.org>
References: <20020312012356.35108475965@postgresql.org>
On Mon, Mar 11, 2002 at 10:31:32PM -0300, feblec@ig.com.br wrote:
> Any example ? Or this is select not implemented ? ( V7.2 )
It's implemented, and has been for a while. Here's a trivial example.
BEGIN;
SELECT * FROM stuff WHERE stuff_id = '1' FOR UPDATE;
-- row 1 is now locked (exclusive), so we can do what needs doing
UPDATE stuff SET something = 'whatever' WHERE stuff_id = '1';
COMMIT;
This is covered in the manual, see
http://www2.ca.postgresql.org/users-lounge/docs/7.2/postgres/sql-select.html
I don't mind answering newbie questions like this in the appropriate
forum (pgsql-novice list for example). In the future please at least
check the manual or give it a try before posting. :)
--
Andrew G. Hammond mailto:drew@xyzzy.dhs.org http://xyzzy.dhs.org/~drew/
56 2A 54 EF 19 C0 3B 43 72 69 5B E3 69 5B A1 1F 613-389-5481
5CD3 62B0 254B DEB1 86E0 8959 093E F70A B457 84B1
"To blow recursion you must first blow recur" -- me
view thread (17+ messages) latest in thread
Message-ID: <20020312174622.GB19889@xyzzy.dhs.org>
Permalink: ../20020312174622.GB19889@xyzzy.dhs.org/
Also on: postgresql.org/message-id/20020312174622.GB19889@xyzzy.dhs.org
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: drew@xyzzy.dhs.org, feblec@ig.com.br
Subject: Re: SELECT FOR UPDATE
In-Reply-To: <20020312174622.GB19889@xyzzy.dhs.org>
* 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