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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: zippy1981 at gmail dot com
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Mon Mar 31 07:01:29 2025 UTC