1--TEST-- 2PDO PgSQL Bug #72633 (Postgres PDO lastInsertId() should work without specifying a sequence) 3--EXTENSIONS-- 4pdo_pgsql 5--SKIPIF-- 6<?php 7require __DIR__ . '/config.inc'; 8require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; 9PDOTest::skip(); 10?> 11--FILE-- 12<?php 13 14require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; 15 16$db = PDOTest::test_factory(__DIR__ . '/common.phpt'); 17 18$db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false); 19 20$db->query('CREATE TABLE test72633 (id SERIAL NOT NULL, field1 VARCHAR(10))'); 21 22$stmt = $db->prepare("INSERT INTO test72633 (field1) VALUES ('test')"); 23 24$stmt->execute(); 25 26/** 27 * No sequence name informed 28 */ 29var_dump($db->lastInsertId()); 30/** 31 * Sequence name informed 32 */ 33var_dump($db->lastInsertId('test72633_id_seq')); 34 35?> 36--CLEAN-- 37<?php 38require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; 39$db = PDOTest::test_factory(__DIR__ . '/common.phpt'); 40$db->query('DROP TABLE IF EXISTS test72633'); 41?> 42--EXPECTREGEX-- 43string\([0-9]*\)\ \"[0-9]*\" 44string\([0-9]*\)\ \"[0-9]*\" 45