pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: John DeSoi <desoi@pgedit.com>
To: Levente Lajko <levente.lajko@topline.co.uk>
Cc: pgsql-sql@postgresql.org
Subject: Re: Updating selected record
Date: Wed, 9 Feb 2005 01:42:14 -0500
Message-ID: <BBEBBEE1-7A65-11D9-9303-000A95B03262@pgedit.com> (raw)
In-Reply-To: <6B588E329B79AB4A919D629A75F5338F041D73@george.topline.co.uk>
References: <6B588E329B79AB4A919D629A75F5338F041D73@george.topline.co.uk>


On Feb 8, 2005, at 9:05 AM, Levente Lajko wrote:

>  
>
> I have problem with a table from where I select specific field data
>
>  SELECT filed1, field2 FROM tbl WHERE progress = 1 LIMIT 1
>
>  through a perl script or multiple instances of that script. The  
> script sets the progress value of the progressed record to 0, so that  
> other processes not to access that row. I presume I would need some  
> locking solution, only I haven’t found the real one.
>
>   
>
> I hope somebody has a bright idea.

Maybe you are looking for SELECT FOR UPDATE as in

SELECT filed1, field2 FROM tbl WHERE progress = 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- 
UPDATE




John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL




view thread (2+ messages)

Message-ID: <BBEBBEE1-7A65-11D9-9303-000A95B03262@pgedit.com>
Permalink:  ../BBEBBEE1-7A65-11D9-9303-000A95B03262@pgedit.com/
Also on:    postgresql.org/message-id/BBEBBEE1-7A65-11D9-9303-000A95B03262@pgedit.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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: desoi@pgedit.com, levente.lajko@topline.co.uk
  Subject: Re: Updating selected record
  In-Reply-To: <BBEBBEE1-7A65-11D9-9303-000A95B03262@pgedit.com>
  References: <6B588E329B79AB4A919D629A75F5338F041D73@george.topline.co.uk> <BBEBBEE1-7A65-11D9-9303-000A95B03262@pgedit.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox