Returns the last inserted ID using currval() which is session dependant rather than last_value which is across all sessions

This commit is contained in:
Neil Gladwin 2017-10-20 13:38:06 +10:00
parent ff64974e45
commit 7a8bcd1ec5

View File

@ -116,8 +116,8 @@ class PostgreSQLConnector extends DBConnector
public function getGeneratedID($table) public function getGeneratedID($table)
{ {
$result = $this->query("SELECT last_value FROM \"{$table}_ID_seq\";")->first(); $result = $this->query("SELECT currval('\"{$table}_ID_seq\"')")->first();
return $result['last_value']; return $result['currval'];
} }
public function getLastError() public function getLastError()