Bug #47199 [Opn->Csd]: pg_delete fails on NULL
| From: | felipe@php.net | Date: | Sat, 06 Nov 2010 17:44:54 +0000 |
| Subject: | Bug #47199 [Opn->Csd]: pg_delete fails on NULL | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-155809@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=47199&edit=1
ID: 47199
Updated by: felipe@php.net
Reported by: andrew at labyrinth-it dot co dot uk
Summary: pg_delete fails on NULL
-Status: Open
+Status: Closed
Type: Bug
Package: PostgreSQL related
Operating System: Linux (Fedora)
PHP Version: 5.2.10
-Assigned To:
+Assigned To: felipe
Block user comment: N
New Comment:
This bug has been fixed in SVN.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Thanks for the patch!
Previous Comments:
------------------------------------------------------------------------
[2010-11-06 18:43:27] felipe@php.net
Automatic comment from SVN on behalf of felipe
Revision: http://svn.php.net/viewvc/?view=revision&revision=305130
Log: - Fixed bug #47199 (pg_delete() fails on NULL)
patch by: ewgraf at gmail dot com
------------------------------------------------------------------------
[2010-02-10 16:40:12] ewgraf at gmail dot com
Patch for this bug:
http://news.php.net/php.internals/46974
------------------------------------------------------------------------
[2009-05-31 06:27:21] andrew at labyrinth-it dot co dot uk
Sorry, I think I posted my reply in the wrong place, so let me try
again.
I have just downloaded and tested the latest PHP version:
PHP 5.2.10RC2-dev (cli) (built: May 31 2009 07:16:36)
With this version I still get the same error. The Postgresql version I
am testing against is:
PostgreSQL 8.3.5 on i386-redhat-linux-gnu, compiled by GCC gcc (GCC)
4.3.2 20081007 (Red Hat 4.3.2-6)
The call to:
print(pg_delete($db,'demo',$row,PGSQL_DML_STRING))
still prints out:
DELETE FROM demo WHERE id=1 AND col1=NULL;
The final test should use the SQL language "IS NULL" test rather than
"=NULL" which never evaluates to true.
The same problem exists if using pg_update, which produces:
UPDATE demo SET id=2,col1='Two' WHERE id=1 AND col1=NULL;
Again, "col1=NULL" will never evaluate to true using SQL, and the test
col1 IS NULL should be used instead.
------------------------------------------------------------------------
[2009-05-19 15:34:41] andrew at labyrinth-it dot co dot uk
For completeness, I get the error running on Fedora 10 with Postgres
8.3.5
------------------------------------------------------------------------
[2009-05-19 15:31:54] andrew at labyrinth-it dot co dot uk
I am using:
PHP 5.2.10-dev (cli) (built: May 19 2009 15:40:36)
and still get the same error result.
This error is also in the pg_update function, where NULl values are
compared with "= NULL" rather than "IS NULL" in the WHERE part of the
generated SQL.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/bug.php?id=47199
--
Edit this bug report at http://bugs.php.net/bug.php?id=47199&edit=1