lastInsertId

lastInsertId at PDO by default check for NULL. At least Postgres. At documentation of PDO - too.