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
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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-2024 The PHP Group
All rights reserved.
Last updated: Tue Dec 03 17:01:29 2024 UTC