[nycphp-talk] getting last inserted id with PostgreSQL
Adam Maccabee Trachtenberg
adam at trachtenberg.com
Sun Nov 21 14:15:41 EST 2004
On Sat, 20 Nov 2004, Mitch Pirtle wrote:
> With MySQL and auto_increment, there is the possibility for an insert
> to happen before you get your value, correct?
>
> Not a dig at MySQL, just wanting clarification on the atomicity of
> doing an insert and then getting the last value from the
> auto_increment fields...
False. MySQL will return the correct value, even if other threads have
inserted new rows between your initial insert and the call to get the
primary key.
-adam
--
adam at trachtenberg.com
author of o'reilly's "upgrading to php 5" and "php cookbook"
avoid the holiday rush, buy your copies today!
More information about the talk
mailing list
Automatic Email Organization without missing anything!