develooper Front page | perl.dbi.users | Postings from August 2006

Re: peer review: recipe for solving SELECT/INSERT/UPDATE race condition

Thread Previous | Thread Next
From:
Stuart Cooper
Date:
August 21, 2006 17:56
Subject:
Re: peer review: recipe for solving SELECT/INSERT/UPDATE race condition
> Sometimes it's desirable to first to a SELECT to see if a row exists,
> and then INSERT if it doesn't already, or UPDATE if it does.

MySQL's got a really handy 'REPLACE INTO' for just this circumstance,
some have suggested that PostgreSQL should support this in future.

Your solution looks good.

Stuart.

Thread Previous | Thread Next


Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About