for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Doctrine\DBAL\Driver\PDOPgSql;
use Doctrine\DBAL\Driver\PDOConnection;
/**
* pdo_pgsql connection implementation.
*/
class Connection extends PDOConnection
{
* {@inheritdoc}
public function lastInsertId($name = null) : string
try {
return $this->fetchLastInsertId($name);
} catch (\PDOException $exception) {
return '0';
}
public function trackLastInsertId() : void
// Do not track last insert ID as it is not considered "safe" and can cause transactions to fail.
// If there is no last insert ID yet, we get an error with SQLSTATE 55000:
// "Object not in prerequisite state: 7 ERROR: lastval is not yet defined in this session"
// That error can modify the transaction/connection state.