xref: /PHP-8.2/ext/pdo_pgsql/tests/bug73959.phpt (revision 39131219)
1--TEST--
2Bug #73959 (lastInsertId fails to throw an exception)
3--EXTENSIONS--
4pdo
5pdo_pgsql
6--SKIPIF--
7<?php
8require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
9require __DIR__ . '/config.inc';
10PDOTest::skip();
11?>
12--FILE--
13<?php
14require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
15require __DIR__ . '/config.inc';
16$db = PDOTest::test_factory(__DIR__ . '/common.phpt');
17$db->setAttribute(PDO::ATTR_PERSISTENT, false);
18$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
19$db->setAttribute(PDO::PGSQL_ATTR_DISABLE_PREPARES, true);
20
21try {
22    $db->lastInsertId('nonexistent_seq');
23    echo "Error: No exception thrown";
24} catch (PDOException $e) {
25    echo "Success: Exception thrown";
26}
27?>
28--EXPECT--
29Success: Exception thrown
30