|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #21332 tableInfo performes hilierious call to the postgresql database
Submitted: 2003-01-02 03:46 UTC Modified: 2003-02-14 05:02 UTC
From: jkkn at tv2 dot dk Assigned:
Status: Closed Package: PEAR related
PHP Version: 4.3.0 OS: Linux
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.
Block user comment
Status: Assign to:
Bug Type:
From: jkkn at tv2 dot dk
New email:
PHP Version: OS:


 [2003-01-02 03:46 UTC] jkkn at tv2 dot dk
Patch below fixes the problem:

--- pgsql.php   Thu Jan  2 10:32:58 2003
+++ pgsql.php.fixed     Thu Jan  2 10:32:47 2003
@@ -700,7 +700,7 @@
         // table without a resultset
         if (is_string($result)) {
-            $id = pg_exec($this->connection,"SELECT * FROM $result");
+            $id = pg_exec($this->connection,"SELECT * FROM $result LIMIT 0");
             if (empty($id)) {
                 return $this->pgsqlRaiseError();


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-01-08 17:19 UTC]
what exactly is the problem?
 [2003-01-10 04:44 UTC] jkkn at tv2 dot dk
The problem is that if you actually have data in your tables, the query as it is in the DB class at the moment will transfer the entire table up to PHP - this takes a lot of time on large tables and is meaningless when what we actually only want is table information.

Adding LIMIT 0 will avoid this and speedup the tableinfo call with minutes on large tables and will do the trick for what we need. This makes tableinfo a usefull feature - right now it is meaningless since you will have to reoptimize it when you actually have data in the table.
 [2003-02-14 05:02 UTC]
This bug has been fixed in CVS. The changes will be included in the next release of PEAR::DB.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed Oct 20 17:03:35 2021 UTC