php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #72633 Postgres PDO lastInsertId() should work without specifying a sequence
Submitted: 2016-07-20 18:00 UTC Modified: 2016-07-27 21:51 UTC
From: zippy1981 at gmail dot com Assigned: ab (profile)
Status: Closed Package: PDO PgSQL
PHP Version: Irrelevant OS: Any
Private report: No CVE-ID: None
 [2016-07-20 18:00 UTC] zippy1981 at gmail dot com
Description:
------------
The code here shows that CURRVAL() is used to get the last id of a named sequence but if NULL is passed, NULL is returned.

https://github.com/php/php-src/blob/php-7.0.9/ext/pdo_pgsql/pgsql_driver.c#L360

However, as of postgres 8.3, the LASTVAL() function has been available to get the last sequence in a session of any sequence. Postgres 8.2 EOL was in 2011.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-07-20 18:49 UTC] zippy1981 at gmail dot com
-Summary: lastInsertId() should work without specifying a sequence +Summary: Postgres PDO lastInsertId() should work without specifying a sequence
 [2016-07-20 18:49 UTC] zippy1981 at gmail dot com
Changed title
 [2016-07-27 21:51 UTC] ab@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: ab
 [2016-07-27 21:51 UTC] ab@php.net
Implemented via https://github.com/php/php-src/pull/2014

Thanks.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 06:01:30 2024 UTC