bug68638.phpt 1.2 KB

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