#36969 [NEW]: pg_query_params fails for integer column with 'insert into..select distinct'

From: Date: Tue, 04 Apr 2006 17:00:24 +0000
Subject: #36969 [NEW]: pg_query_params fails for integer column with 'insert into..select distinct'
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-95307@lists.php.net to get a copy of this message
From: alan dot harder at sun dot com Operating system: Debian PHP version: 5.1.3RC2 PHP Bug Type: PostgreSQL related Bug description: pg_query_params fails for integer column with 'insert into..select distinct' 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 bug report at http://bugs.php.net/?id=36969&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=36969&r=trysnapshot44 Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=36969&r=trysnapshot51 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=36969&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=36969&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=36969&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=36969&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=36969&r=needscript Try newer version: http://bugs.php.net/fix.php?id=36969&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=36969&r=support Expected behavior: http://bugs.php.net/fix.php?id=36969&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=36969&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=36969&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=36969&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=36969&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=36969&r=dst IIS Stability: http://bugs.php.net/fix.php?id=36969&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=36969&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=36969&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=36969&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=36969&r=mysqlcfg

« previous php.bugs (#95307) next »