mirror of
https://github.com/silverstripe/silverstripe-postgresql
synced 2024-10-22 17:05:45 +02:00
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:
parent
ff64974e45
commit
7a8bcd1ec5
@ -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()
|
||||||
|
Loading…
Reference in New Issue
Block a user