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