From: Larry Rosenman <ler@lerctr.org>
To: 'Flavio Suguimoto' <flavio.suguimoto@pragyatechnologies.com>
To: pgsql-sql@postgresql.org
Subject: Re: Locking row
Date: Fri, 10 Mar 2006 14:57:51 -0600
Message-ID: <023e01c64485$4be7f630$0a0a0a0a@aus.pervasive.com> (raw)
In-Reply-To: <GFEGIFLJJCMGLBLAHILKEEDECGAA.flavio.suguimoto@pragyatechnologies.com>
Flavio Suguimoto wrote:
> Hi all,
>
> I need to mark a row with a value in a column, but first i need to
> select the first row without this mark. But in some concurrents cases
> i mark the row twice. How can i lock the row to avoid others session
> get it?
>
> TABLE TICKET
> TICKET_NUMBER | MARK
> 00001 | 1
> 00002 | 0
>
> I need to select the first row with 0 in MARK column and then mark it
> with 1.
look at the FOR UPDATE in the select docs.
--
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 512-248-2683 E-Mail: ler@lerctr.org
US Mail: 430 Valona Loop, Round Rock, TX 78681-3893
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: ler@lerctr.org, flavio.suguimoto@pragyatechnologies.com
Subject: Re: Locking row
In-Reply-To: <023e01c64485$4be7f630$0a0a0a0a@aus.pervasive.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