Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb34f8f4

Browse files
committed
Show schemas in information_schema.schemata that the current has access to
Before, it would only show schemas that the current user owns. Perdiscussion, the new behavior is more useful and consistent for PostgreSQL.
1 parent71901ab commitb34f8f4

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

‎doc/src/sgml/information_schema.sgml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4547,8 +4547,9 @@ ORDER BY c.ordinal_position;
45474547
<title><literal>schemata</literal></title>
45484548

45494549
<para>
4550-
The view <literal>schemata</literal> contains all schemas in the
4551-
current database that are owned by a currently enabled role.
4550+
The view <literal>schemata</literal> contains all schemas in the current
4551+
database that the current user has access to (by way of being the owner or
4552+
having some privilege).
45524553
</para>
45534554

45544555
<table>

‎src/backend/catalog/information_schema.sql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1502,7 +1502,9 @@ CREATE VIEW schemata AS
15021502
CAST(nullAS sql_identifier)AS default_character_set_name,
15031503
CAST(nullAS character_data)AS sql_path
15041504
FROM pg_namespace n, pg_authid u
1505-
WHEREn.nspowner=u.oidAND pg_has_role(n.nspowner,'USAGE');
1505+
WHEREn.nspowner=u.oid
1506+
AND (pg_has_role(n.nspowner,'USAGE')
1507+
OR has_schema_privilege(n.oid,'CREATE, USAGE'));
15061508

15071509
GRANTSELECTON schemata TO PUBLIC;
15081510

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp