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