note 84530 added to pdo.lastinsertid
| From: | lod at osu1 dot php dot net | Date: | Thu, 17 Jul 2008 15:41:41 +0000 |
| Subject: | note 84530 added to pdo.lastinsertid | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-141632@lists.php.net to get a copy of this message | ||
Using Postgresql calling this function is identical to doing (with appropriate quoting):
PDO::query("SELECT CURRVAL($name)");
That's the exact query performed by PDO source code used.
(version checked current at time of writing, pgsql_driver.c,v 1.68 2007/12/31)
In particular this means that in normal operation you are still in auto-commit mode and CURRVAL is
subject to race conditions.
To use this function safely in Postgresql you MUST wrap it in a beginTransaction() commit() block.
----
Server IP: 117.104.160.194
Probable Submitter: 59.167.44.72
----
Manual Page -- http://www.php.net/manual/en/pdo.lastinsertid.php
Edit -- https://master.php.net/note/edit/84530
Del: integrated -- https://master.php.net/note/delete/84530/integrated
Del: useless -- https://master.php.net/note/delete/84530/useless
Del: bad code -- https://master.php.net/note/delete/84530/bad+code
Del: spam -- https://master.php.net/note/delete/84530/spam
Del: non-english -- https://master.php.net/note/delete/84530/non-english
Del: in docs -- https://master.php.net/note/delete/84530/in+docs
Del: other reasons-- https://master.php.net/note/delete/84530
Reject -- https://master.php.net/note/reject/84530
Search -- https://master.php.net/manage/user-notes.php