ID: 36969
User updated by: alan dot harder at sun dot com
Reported By: alan dot harder at sun dot com
Status: Open
Bug Type: PostgreSQL related
Operating System: Debian
-PHP Version: 5.1.3RC2
+PHP Version: 5.1.5
New Comment:
Tested on PHP 5.1.5.. same result.
Previous Comments:
------------------------------------------------------------------------
[2006-04-04 17:00:24] alan dot harder at sun dot com
Description:
------------
parameter given as integer but treated as text with particular sql
syntax. remove "distinct" from the sql and it works.
Tested with PHP 5.1.2 and PHP 5.1.3-RC2
pg_version output:
array(3) { ["client"]=> string(5) "8.1.2" ["protocol"]=> int(3)
["server"]=> string(6) "7.4.11" }
Reproduce code:
---------------
First in psql:
create table test (val integer);
Test code:
<?php
$db = pg_connect('dbname=testdb');
if (!$db) return;
$s = pg_query_params($db, 'insert into test select distinct $1',
array(666));
if ($s === false) {
print pg_last_error($db);
} else {
print "OK\n";
}
pg_close($db);
?>
Expected result:
----------------
OK
Actual result:
--------------
Warning: pg_query_params() [function.pg-query-params]: Query failed:
ERROR: column "val" is of type integer but expression is of type text
HINT: You will need to rewrite or cast the expression. in
/usr/home/mindless/public_html/pgtest.php on line 5
ERROR: column "val" is of type integer but expression is of type text
HINT: You will need to rewrite or cast the expression.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=36969&edit=1