public function getLastInsertId($tableName = null)
{
$tableName = empty($tableName) ? $this->name : $tableName;
if ($this->getDriverName() == 'pdo_pgsql') {
$row = $this->fetchRow(sprintf("SELECT currval('%s_id_seq') AS value", $tableName));
return $row['value'];
}
return $this->getAdapter()->getDriver()->getConnection()->getLastGeneratedValue($tableName);
}