diff --git a/lib/Doctrine/Connection/UnitOfWork.php b/lib/Doctrine/Connection/UnitOfWork.php index 22817f8a0..1d05689c1 100644 --- a/lib/Doctrine/Connection/UnitOfWork.php +++ b/lib/Doctrine/Connection/UnitOfWork.php @@ -327,7 +327,12 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module implemen $this->conn->insert($table->getTableName(), $array); if (empty($seq) && count($keys) == 1 && $keys[0] == $table->getIdentifier()) { - $id = $this->conn->sequence->lastInsertId(); + + if (strtolower($this->conn->getName()) == 'pgsql') { + $seq = $table->getTableName() . '_' . $keys[0] . '_seq'; + } + + $id = $this->conn->sequence->lastInsertId($seq); if ( ! $id) { $id = $table->getMaxIdentifier();