summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume (ioguix) de Rorthais2010-10-22 15:47:09 +0000
committerGuillaume (ioguix) de Rorthais2010-10-22 15:47:09 +0000
commitb58def925d037271318c8a9e218de5f70404a984 (patch)
tree29d1c92bb3b4d1fbbd4001d3d7c1375ca49dcea1
parent18224d0f088047423c8b7058809eade13324836f (diff)
Fix for bug #3092826 "schema owner is blank for role with nologin", reported by Sompop
-rwxr-xr-xclasses/database/Postgres.php4
-rw-r--r--classes/database/Postgres80.php28
2 files changed, 30 insertions, 2 deletions
diff --git a/classes/database/Postgres.php b/classes/database/Postgres.php
index f579f299..5e4dba0b 100755
--- a/classes/database/Postgres.php
+++ b/classes/database/Postgres.php
@@ -861,10 +861,10 @@ class Postgres extends ADODB_base {
}
else $where = "WHERE nspname !~ '^pg_t(emp_[0-9]+|oast)$'";
$sql = "
- SELECT pn.nspname, pu.usename AS nspowner,
+ SELECT pn.nspname, pu.rolname AS nspowner,
pg_catalog.obj_description(pn.oid, 'pg_namespace') AS nspcomment
FROM pg_catalog.pg_namespace pn
- LEFT JOIN pg_catalog.pg_user pu ON (pn.nspowner = pu.usesysid)
+ LEFT JOIN pg_catalog.pg_authid pu ON (pn.nspowner = pu.oid)
{$where}
ORDER BY nspname";
diff --git a/classes/database/Postgres80.php b/classes/database/Postgres80.php
index b64327b7..0bb9db64 100644
--- a/classes/database/Postgres80.php
+++ b/classes/database/Postgres80.php
@@ -106,6 +106,34 @@ class Postgres80 extends Postgres81 {
// Schema functions
/**
+ * Return all schemas in the current database.
+ * @return All schemas, sorted alphabetically
+ */
+ function getSchemas() {
+ global $conf, $slony;
+
+ if (!$conf['show_system']) {
+ $where = "WHERE nspname NOT LIKE 'pg@_%' ESCAPE '@' AND nspname != 'information_schema'";
+ if (isset($slony) && $slony->isEnabled()) {
+ $temp = $slony->slony_schema;
+ $this->clean($temp);
+ $where .= " AND nspname != '{$temp}'";
+ }
+
+ }
+ else $where = "WHERE nspname !~ '^pg_t(emp_[0-9]+|oast)$'";
+ $sql = "
+ SELECT pn.nspname, pu.usename AS nspowner,
+ pg_catalog.obj_description(pn.oid, 'pg_namespace') AS nspcomment
+ FROM pg_catalog.pg_namespace pn
+ LEFT JOIN pg_catalog.pg_user pu ON (pn.nspowner = pu.usesysid)
+ {$where}
+ ORDER BY nspname";
+
+ return $this->selectSet($sql);
+ }
+
+ /**
* Return all information relating to a schema
* @param $schema The name of the schema
* @return Schema information