Received: from primus.vsservices.com (primus.vsservices.com [63.66.136.75]) by postgresql.org (8.11.3/8.11.4) with ESMTP id g1FLp6E09850 for ; Fri, 15 Feb 2002 16:51:06 -0500 (EST) (envelope-from postgres@vsservices.com) Received: from prime.vsservices.com (conr-adsl-dhcp-26-38.txucom.net [209.34.26.38]) by primus.vsservices.com (8.11.3/8.11.3) with SMTP id g1FLp7k84701 for ; Fri, 15 Feb 2002 15:51:07 -0600 (CST) (envelope-from postgres@vsservices.com) Date: Fri, 15 Feb 2002 15:51:07 -0600 From: GB Clark To: pgsql-sql@postgresql.org Message-Id: <20020215155107.1e405665.postgres@vsservices.com> In-Reply-To: <20020215104908.Y37614-100000@megazone23.bigpanda.com> References: <002101c1b650$18f087a0$0201a8c0@osprey> <20020215104908.Y37614-100000@megazone23.bigpanda.com> X-Mailer: Sylpheed version 0.6.6 (GTK+ 1.2.10; i386-unknown-freebsd4.4) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Archive-Number: 200202/189 X-Sequence-Number: 6615 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?