pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruno Wolff III <bruno@wolff.to>
To: scott.marlowe <scott.marlowe@ihs.com>
Cc: David Busby <busby@pnts.com>
Cc: pgsql-php@postgresql.org
Subject: Re: Need to select and update with the same sql statement
Date: Thu, 14 Nov 2002 07:45:14 -0600
Message-ID: <20021114134514.GA20110@wolff.to> (raw)
In-Reply-To: <Pine.LNX.4.33.0211131525230.32326-100000@css120.ihs.com>
References: <Pine.LNX.4.33.0211131457520.32190-100000@css120.ihs.com>
	<Pine.LNX.4.33.0211131525230.32326-100000@css120.ihs.com>

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.



view thread (7+ messages)

Message-ID: <20021114134514.GA20110@wolff.to>
Permalink:  ../20021114134514.GA20110@wolff.to/
Also on:    postgresql.org/message-id/20021114134514.GA20110@wolff.to

 · 

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-php@postgresql.org
  Cc: bruno@wolff.to, scott.marlowe@ihs.com, busby@pnts.com
  Subject: Re: Need to select and update with the same sql statement
  In-Reply-To: <20021114134514.GA20110@wolff.to>
  References: <Pine.LNX.4.33.0211131457520.32190-100000@css120.ihs.com> <Pine.LNX.4.33.0211131525230.32326-100000@css120.ihs.com> <20021114134514.GA20110@wolff.to>

* 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