bug68638.phpt 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. --TEST--
  2. Bug #68638 pg_update() fails to store infinite values
  3. --EXTENSIONS--
  4. pgsql
  5. --SKIPIF--
  6. <?php include("skipif.inc"); ?>
  7. --FILE--
  8. <?php
  9. include('config.inc');
  10. $conn = pg_connect($conn_str);
  11. $table='test_68638';
  12. pg_query($conn, "CREATE TABLE $table (id INT, value FLOAT)");
  13. pg_insert($conn,$table, array('id' => 1, 'value' => 1.2));
  14. pg_insert($conn,$table, array('id' => 2, 'value' => 10));
  15. pg_insert($conn,$table, array('id' => 3, 'value' => 15));
  16. var_dump(pg_update($conn,$table, array('value' => 'inf'), array('id' => 1), PGSQL_DML_STRING));
  17. pg_update($conn,$table, array('value' => 'inf'), array('id' => 1));
  18. pg_update($conn,$table, array('value' => '-inf'), array('id' => 2));
  19. pg_update($conn,$table, array('value' => '+inf'), array('id' => 3));
  20. $rs = pg_query($conn, "SELECT * FROM $table");
  21. while ($row = pg_fetch_assoc($rs)) {
  22. var_dump($row);
  23. }
  24. pg_query($conn, "DROP TABLE $table");
  25. ?>
  26. --EXPECT--
  27. string(52) "UPDATE "test_68638" SET "value"=E'inf' WHERE "id"=1;"
  28. array(2) {
  29. ["id"]=>
  30. string(1) "1"
  31. ["value"]=>
  32. string(8) "Infinity"
  33. }
  34. array(2) {
  35. ["id"]=>
  36. string(1) "2"
  37. ["value"]=>
  38. string(9) "-Infinity"
  39. }
  40. array(2) {
  41. ["id"]=>
  42. string(1) "3"
  43. ["value"]=>
  44. string(8) "Infinity"
  45. }