Skip to content

Commit

Permalink
Fix for bug #3092826 "schema owner is blank for role with nologin", r…
Browse files Browse the repository at this point in the history
…eported by Sompop
  • Loading branch information
ioguix committed Oct 22, 2010
1 parent 18224d0 commit b58def9
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
4 changes: 2 additions & 2 deletions classes/database/Postgres.php
Expand Up @@ -861,10 +861,10 @@ function getSchemas() {
}
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";

Expand Down
28 changes: 28 additions & 0 deletions classes/database/Postgres80.php
Expand Up @@ -105,6 +105,34 @@ function getDatabases($currentdatabase = NULL) {

// 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
Expand Down

0 comments on commit b58def9

Please sign in to comment.