diff --git a/adminer/drivers/pgsql.inc.php b/adminer/drivers/pgsql.inc.php index 198e6429..80f5b13e 100644 --- a/adminer/drivers/pgsql.inc.php +++ b/adminer/drivers/pgsql.inc.php @@ -274,7 +274,9 @@ if (isset($_GET["pgsql"])) { } function get_databases() { - return get_vals("SELECT datname FROM pg_database WHERE has_database_privilege(datname, 'CONNECT') ORDER BY datname"); + return get_vals("SELECT d.datname FROM pg_database d JOIN pg_roles r ON d.datdba = r.oid + WHERE d.datallowconn = TRUE AND has_database_privilege(d.datname, 'CONNECT') AND pg_has_role(r.rolname, 'USAGE') + ORDER BY d.datname"); } function limit($query, $where, $limit, $offset = 0, $separator = " ") {