Edit report at http://bugs.php.net/bug.php?id=54026&edit=1
ID: 54026
User updated by: abrahala at gmail dot com
Reported by: abrahala at gmail dot com
-Summary: PostgreSQL: cannot bind NULL value to statement
+Summary: PostgreSQL: cannot bind NULL value to statement
condition
Status: Open
Type: Bug
Package: PDO related
Operating System: Debian GNU/Linux 2.6.26-2-amd64
PHP Version: 5.3.5
Block user comment: N
Private report: N
New Comment:
Sorry, I forgot to mention this only applies to binding a null value as
part of a condition. Value assignment works fine (fieldName =
:nullValue), so it might has to do something with the 'IS' keryword?
Previous Comments:
------------------------------------------------------------------------
[2011-02-15 14:59:36] abrahala at gmail dot com
Description:
------------
It seems to be impossible to pass NULL value to a PDO PostgreSQL
statement neither with bindValue nor using '?'-format and
$statement->execute(array(null)).
Test script:
---------------
$pdo = new PDO('pgsql:host=localhost;port=5432;dbname=db', 'user',
'pass');
$statement = $pdo->prepare('SELECT \'ok\' WHERE NULL IS :nullValue');
$statement->bindValue(':nullValue', null, PDO::PARAM_NULL);
$statement->execute();
$result = $statement->fetchColumn(0);
var_export($result);
Expected result:
----------------
'ok'
Actual result:
--------------
false
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=54026&edit=1