xref: /PHP-8.1/ext/pgsql/tests/80_bug42783.phpt (revision 1f427779)
1--TEST--
2Bug #42783 (pg_insert() does not support an empty value array)
3--EXTENSIONS--
4pgsql
5--SKIPIF--
6<?php
7require_once('skipif.inc');
8?>
9--FILE--
10<?php
11
12require_once('config.inc');
13
14$dbh = @pg_connect($conn_str);
15if (!$dbh) {
16    die ("Could not connect to the server");
17}
18
19pg_query($dbh, "CREATE TABLE php_test (id SERIAL PRIMARY KEY, time TIMESTAMP NOT NULL DEFAULT now())");
20
21pg_insert($dbh, 'php_test', array());
22
23var_dump(pg_fetch_assoc(pg_query($dbh, "SELECT * FROM php_test")));
24
25pg_query($dbh, "DROP TABLE php_test");
26pg_close($dbh);
27?>
28--EXPECTF--
29array(2) {
30  ["id"]=>
31  string(%d) "%d"
32  ["time"]=>
33  string(%d) "%s"
34}
35