consider information_schema to be a system object. remove unused schema vars
authorchriskl <chriskl>
Tue, 12 Aug 2003 01:33:56 +0000 (01:33 +0000)
committerchriskl <chriskl>
Tue, 12 Aug 2003 01:33:56 +0000 (01:33 +0000)
HISTORY
classes/database/Postgres73.php
classes/database/Postgres74.php

diff --git a/HISTORY b/HISTORY
index 31d16be05b3c59553873dc05b06eec92f62aed79..6ada01c36a5ec91eba307575f94524013cfef380 100644 (file)
--- a/HISTORY
+++ b/HISTORY
@@ -31,6 +31,7 @@ Bug Fixes:
 * Boolean default values and general boolean field handling fixes
 * Support zero column tables
 * Correctly display the contents of bytea fields
+* Consider information_schema to be a system object
 
 Version 3.0
 -----------
index 13d17a0c7f7f4e181edb2d7299be880b610dbbb2..00b1b28b5d4b43d8e46f13f37cace30edd4f1741 100644 (file)
@@ -4,7 +4,7 @@
  * A class that implements the DB interface for Postgres
  * Note: This class uses ADODB and returns RecordSets.
  *
- * $Id: Postgres73.php,v 1.57 2003/08/06 02:09:25 chriskl Exp $
+ * $Id: Postgres73.php,v 1.58 2003/08/12 01:33:56 chriskl Exp $
  */
 
 // @@@ THOUGHT: What about inherits? ie. use of ONLY???
@@ -25,10 +25,6 @@ class Postgres73 extends Postgres72 {
        // Max object name length
        var $_maxNameLen = 63;
 
-       // System schema ids and names
-       var $_schemaOIDs = array(11, 99);
-       var $_schemaNames = array('pg_catalog', 'pg_toast');
-
        // List of all legal privileges that can be applied to different types
        // of objects.
        var $privlist = array(
index ec0852a1edddf06ae3f83e254df240a1c1e31f16..f48d2af214b60fe3adb0501126cd20d740667df4 100644 (file)
@@ -4,7 +4,7 @@
  * A class that implements the DB interface for Postgres
  * Note: This class uses ADODB and returns RecordSets.
  *
- * $Id: Postgres74.php,v 1.10 2003/08/11 05:48:04 chriskl Exp $
+ * $Id: Postgres74.php,v 1.11 2003/08/12 01:33:56 chriskl Exp $
  */
 
 include_once('classes/database/Postgres73.php');
@@ -17,10 +17,6 @@ class Postgres74 extends Postgres73 {
        // Max object name length
        var $_maxNameLen = 63;
 
-       // System schema ids and names
-       var $_schemaOIDs = array(11, 99);
-       var $_schemaNames = array('pg_catalog', 'pg_toast');
-
        /**
         * Constructor
         * @param $host The hostname to connect to
@@ -48,7 +44,26 @@ class Postgres74 extends Postgres73 {
                                        ORDER BY s.usename";
 
                return $this->selectSet($sql);
-       }               
+       }
+       
+       // Schema functions
+       
+       /**
+        * Return all schemas in the current database.  This differs from the version
+        * in 7.3 only in that it considers the information_schema to be a system schema.
+        * @return All schemas, sorted alphabetically
+        */
+       function &getSchemas() {
+               global $conf;
+               
+               if (!$conf['show_system']) $and = "AND nspname NOT LIKE 'pg_%' AND nspname != 'information_schema'";
+               else $and = '';
+               $sql = "SELECT pn.nspname, pu.usename AS nspowner FROM pg_catalog.pg_namespace pn, pg_catalog.pg_user pu
+                       WHERE pn.nspowner = pu.usesysid
+                       {$and}ORDER BY nspname";
+
+               return $this->selectSet($sql);
+       }       
 
        // View functions