php.net |  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
 [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();
             }

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-01-08 17:19 UTC] kalowsky@php.net
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] mj@php.net
This bug has been fixed in CVS. The changes will be included in the next release of PEAR::DB.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 23:01:26 2024 UTC