Re: Locking row

From: "Larry Rosenman" <ler(at)lerctr(dot)org>
To: "'Flavio Suguimoto'" <flavio(dot)suguimoto(at)pragyatechnologies(dot)com>, <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Locking row
Date: 2006-03-10 20:57:51
Message-ID: 023e01c64485$4be7f630$0a0a0a0a@aus.pervasive.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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(at)lerctr(dot)org
US Mail: 430 Valona Loop, Round Rock, TX 78681-3893

In response to

  • Locking row at 2006-03-10 20:50:10 from Flavio Suguimoto

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Bryce Nesbitt 2006-03-11 00:17:06 Advice on setting up a grid like view for spreadsheet users
Previous Message Flavio Suguimoto 2006-03-10 20:50:10 Locking row