Bug #70789 [NEW]: Datatype mismatch for postgres expression
From: stefan at php-engineer dot de
Operating system: Ubuntu 14.04.1 LTS
PHP version: 5.6.14
Package: PDO PgSQL
Bug Type: Bug
Bug description:Datatype mismatch for postgres expression
Description:
------------
More information about this issue:
https://github.com/cakephp/cakephp/issues/7534
Test script:
---------------
$db = new
PDO('pgsql:host=localhost;dbname=cake_test_db;user=markstory');
$stmt = $db->prepare('UPDATE categories SET priority = (CASE WHEN id =
:c0 THEN :c1 END) WHERE id in (:c2)');
$stmt->bindValue('c0', '52852e5c-5761-4b87-91d3-456f1dff1469',
PDO::PARAM_STR);
$stmt->bindValue('c1', 2, PDO::PARAM_INT);
$stmt->bindValue('c2', '52852e5c-5761-4b87-91d3-456f1dff1469',
PDO::PARAM_STR);
$out = $stmt->execute();
var_dump($out);
var_dump('Error code', $stmt->errorCode());
var_dump('Error info', $stmt->errorInfo());
Actual result:
--------------
SQLSTATE[42804]: Datatype mismatch: 7 ERROR: column "priority" is of
type integer but expression is of type text
LINE 1: UPDATE categories SET priority = (CASE WHEN id = $1 THEN $2 ...
^
HINT: You will need to rewrite or cast the expression.
--
Edit bug report at https://bugs.php.net/bug.php?id=70789&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70789&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70789&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70789&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=70789&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=70789&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=70789&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=70789&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=70789&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=70789&r=support
Expected behavior: https://bugs.php.net/fix.php?id=70789&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=70789&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=70789&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=70789&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70789&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=70789&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=70789&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=70789&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=70789&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=70789&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=70789&r=mysqlcfg
Thread (2 messages)
- stefan at php-engineer dot de