80_bug42783.phpt 634 B

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