Re: Need to select and update with the same sql statement - Mailing list pgsql-php

From Bruno Wolff III
Subject Re: Need to select and update with the same sql statement
Date
Msg-id 20021114134514.GA20110@wolff.to
Whole thread Raw
In response to Re: Need to select and update with the same sql statement  ("scott.marlowe" <scott.marlowe@ihs.com>)
List pgsql-php
On Wed, Nov 13, 2002 at 15:26:42 -0700,
  "scott.marlowe" <scott.marlowe@ihs.com> wrote:
>
> Oh, I just thought of the better way than locking the whole table is to
> use a "select for update" on the row you want to lock.  I think that'll do
> what you want and without locking the whole table.  Of course, 20 lines of
> PHP code runs pretty fast, so unless you're handling lotsa traffic locking
> the table probably works fine too.

This came up in a discussion recently and it really isn't better. If you
do this you have to worry about the select for update returning zero
rows (even with the limit 1 clause) and retry the query if it does.

pgsql-php by date:

Previous
From: "Phil Geer"
Date:
Subject: Re: serial type question
Next
From: "scott.marlowe"
Date:
Subject: Re: serial type question