Bug #54026 [Fbk->NoF]: PostgreSQL: cannot bind NULL value to statement condition
Edit report at https://bugs.php.net/bug.php?id=54026&edit=1
ID: 54026
Updated by: php-bugs@lists.php.net
Reported by: abrahala at gmail dot com
Summary: PostgreSQL: cannot bind NULL value to statement
condition
-Status: Feedback
+Status: No Feedback
Type: Bug
Package: PDO related
Operating System: Debian GNU/Linux 2.6.26-2-amd64
PHP Version: 5.3.5
Private report: N
New Comment:
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
Previous Comments:
------------------------------------------------------------------------
[2013-06-28 20:16:06] yohgaki@php.net
Did last comment work for you?
------------------------------------------------------------------------
[2011-07-30 23:36:09] dverite at gmail dot com
You should write "...WHERE :nullValue IS NULL" instead of ".. WHERE NULL IS
:nullValue", otherwise execute() fails with a syntax error.
I'm not sure your example would work anyway since passing a null value in a bind parameter
seems problematic, but at least it would fail because of PDO and not because of the SQL itself :)
------------------------------------------------------------------------
[2011-02-15 15:28:42] abrahala at gmail dot com
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?
------------------------------------------------------------------------
[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 https://bugs.php.net/bug.php?id=54026&edit=1
Thread (5 messages)