Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 2860596

Browse files
committed
Doc: fix missing explanation of default object privileges.
The GRANT reference page, which lists the default privileges for new objects, failed to mention that USAGE is granted by default for data types and domains. As a lesser sin, it also did not specify anything about the initial privileges for sequences, FDWs, foreign servers, or large objects. Fix that, and add a comment to acldefault() in the probably vain hope of getting people to maintain this list in future. Noted by Laurenz Albe, though I editorialized on the wording a bit. Back-patch to all supported branches, since they all have this behavior. Discussion: https://postgr.es/m/1507620895.4152.1.camel@cybertec.at
1 parent 20d210b commit 2860596

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

doc/src/sgml/ref/grant.sgml

+15-5
Original file line numberDiff line numberDiff line change
@@ -156,12 +156,22 @@ GRANT <replaceable class="parameter">role_name</replaceable> [, ...] TO <replace
156156
<para>
157157
PostgreSQL grants default privileges on some types of objects to
158158
<literal>PUBLIC</literal>. No privileges are granted to
159-
<literal>PUBLIC</literal> by default on tables,
160-
columns, schemas or tablespaces. For other types, the default privileges
159+
<literal>PUBLIC</literal> by default on
160+
tables,
161+
table columns,
162+
sequences,
163+
foreign data wrappers,
164+
foreign servers,
165+
large objects,
166+
schemas,
167+
or tablespaces.
168+
For other types of objects, the default privileges
161169
granted to <literal>PUBLIC</literal> are as follows:
162-
<literal>CONNECT</literal> and <literal>CREATE TEMP TABLE</literal> for
163-
databases; <literal>EXECUTE</literal> privilege for functions; and
164-
<literal>USAGE</literal> privilege for languages.
170+
<literal>CONNECT</literal> and <literal>TEMPORARY</literal> (create
171+
temporary tables) privileges for databases;
172+
<literal>EXECUTE</literal> privilege for functions; and
173+
<literal>USAGE</literal> privilege for languages and data types
174+
(including domains).
165175
The object owner can, of course, <command>REVOKE</command>
166176
both default and expressly granted privileges. (For maximum
167177
security, issue the <command>REVOKE</> in the same transaction that

src/backend/utils/adt/acl.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,9 @@ hash_aclitem_extended(PG_FUNCTION_ARGS)
737737
* acldefault() --- create an ACL describing default access permissions
738738
*
739739
* Change this routine if you want to alter the default access policy for
740-
* newly-created objects (or any object with a NULL acl entry).
740+
* newly-created objects (or any object with a NULL acl entry). When
741+
* you make a change here, don't forget to update the GRANT man page,
742+
* which explains all the default permissions.
741743
*
742744
* Note that these are the hard-wired "defaults" that are used in the
743745
* absence of any pg_default_acl entry.

0 commit comments

Comments
 (0)