Re: Need to select and update with the same sql statement

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Wed, Nov 13, 2002 at 15:26:42 -0700,
  "scott.marlowe" <scott.marlowe@xxxxxxx> 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.


[Index of Archives]     [Postgresql General]     [Postgresql Admin]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Yosemite Backpacking]     [Postgresql Jobs]

  Powered by Linux