php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25086 DB:: postgres driver does not support EXPLAIN
Submitted: 2003-08-13 22:36 UTC Modified: 2003-08-28 09:38 UTC
From: alan at akbkhome dot com Assigned: cox (profile)
Status: Closed Package: PEAR related
PHP Version: Irrelevant OS: na
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: alan at akbkhome dot com
New email:
PHP Version: OS:

 

 [2003-08-13 22:36 UTC] alan at akbkhome dot com
Description:
------------
not that the information is that helpfull :)  


--- Projects/pear/pearcvs/DB/DB/pgsql.php       2003-07-19 17:38:35.000000000 +0800
+++ /usr/share/pear/DB/pgsql.php        2003-08-14 11:24:34.000000000 +0800
@@ -170,8 +170,9 @@
         if ($ismanip) {
             $this->affected = @pg_cmdtuples($result);
             return DB_OK;
-        } elseif (preg_match('/^\s*\(?\s*SELECT\s+/si', $query) &&
-                  !preg_match('/^\s*\(?\s*SELECT\s+INTO\s/si', $query)) {
+        } elseif ((preg_match('/^\s*\(?\s*SELECT\s+/si', $query) &&
+                  !preg_match('/^\s*\(?\s*SELECT\s+INTO\s/si', $query)) ||
+                  preg_match('/^\s*EXPLAIN/si',$query )) {
             /* PostgreSQL commands:
                ABORT, ALTER, BEGIN, CLOSE, CLUSTER, COMMIT, COPY,
                CREATE, DECLARE, DELETE, DROP TABLE, EXPLAIN, FETCH,


Reproduce code:
---------------
$db->getAll('EXPLAIN SELECT * FROM anytable');

will barf with selecton on non-object.

** DB_Common::getAll() should also check the return value for query is not an integer...




Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-08-28 09:38 UTC] cox@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, 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/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sat Dec 04 01:04:24 2021 UTC