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