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