Commit b34f8f40 authored by Peter Eisentraut's avatar Peter Eisentraut

Show schemas in information_schema.schemata that the current has access to

Before, it would only show schemas that the current user owns.  Per
discussion, the new behavior is more useful and consistent for PostgreSQL.
parent 71901ab6
......@@ -4547,8 +4547,9 @@ ORDER BY c.ordinal_position;
<title><literal>schemata</literal></title>
<para>
The view <literal>schemata</literal> contains all schemas in the
current database that are owned by a currently enabled role.
The view <literal>schemata</literal> contains all schemas in the current
database that the current user has access to (by way of being the owner or
having some privilege).
</para>
<table>
......
......@@ -1502,7 +1502,9 @@ CREATE VIEW schemata AS
CAST(null AS sql_identifier) AS default_character_set_name,
CAST(null AS character_data) AS sql_path
FROM pg_namespace n, pg_authid u
WHERE n.nspowner = u.oid AND pg_has_role(n.nspowner, 'USAGE');
WHERE n.nspowner = u.oid
AND (pg_has_role(n.nspowner, 'USAGE')
OR has_schema_privilege(n.oid, 'CREATE, USAGE'));
GRANT SELECT ON schemata TO PUBLIC;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment