X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2D3208B9FD8 for ; Wed, 9 Feb 2005 06:42:43 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 42529-02 for ; Wed, 9 Feb 2005 06:42:27 +0000 (GMT) Received: from a2s1.a2webhosting.com (host-180.a2webhosting.com [69.39.89.180]) by svr1.postgresql.org (Postfix) with ESMTP id 2F23D8B9D68 for ; Wed, 9 Feb 2005 06:42:23 +0000 (GMT) Received: from user-1120vgk.dsl.mindspring.com ([66.32.126.20] helo=[192.168.1.10]) by a2s1.a2webhosting.com with esmtpsa (TLSv1:RC4-SHA:128) (Exim 4.44) id 1CylYN-0007nk-A3; Wed, 09 Feb 2005 01:42:23 -0500 In-Reply-To: <6B588E329B79AB4A919D629A75F5338F041D73@george.topline.co.uk> References: <6B588E329B79AB4A919D629A75F5338F041D73@george.topline.co.uk> Mime-Version: 1.0 (Apple Message framework v619) Content-Type: text/plain; charset=WINDOWS-1252; delsp=yes; format=flowed Message-Id: Content-Transfer-Encoding: quoted-printable Cc: From: John DeSoi Subject: Re: Updating selected record Date: Wed, 9 Feb 2005 01:42:14 -0500 To: "Levente Lajko" X-Mailer: Apple Mail (2.619) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - a2s1.a2webhosting.com X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - pgedit.com X-Source: X-Source-Args: X-Source-Dir: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.015 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/113 X-Sequence-Number: 20224 On Feb 8, 2005, at 9:05 AM, Levente Lajko wrote: > =A0 > > I have problem with a table from where I select specific field data > > SELECT filed1, field2 FROM tbl WHERE progress =3D 1 LIMIT 1 > > =A0through a perl script or multiple instances of that script. The =20 > script sets the progress value of the progressed record to 0, so that =20= > other processes not to access that row. I presume I would need some =20= > locking solution, only I haven=92t found the real one. > > =A0 > > I hope somebody has a bright idea. Maybe you are looking for SELECT FOR UPDATE as in SELECT filed1, field2 FROM tbl WHERE progress =3D 1 LIMIT 1 FOR UPDATE; This locks the row for the remainder of the transaction. See http://www.postgresql.org/docs/8.0/interactive/sql-select.html#SQL-FOR-=20= UPDATE John DeSoi, Ph.D. http://pgedit.com/ Power Tools for PostgreSQL