Doc: fix missing explanation of default object privileges.
authorTom Lane
Wed, 11 Oct 2017 20:56:23 +0000 (16:56 -0400)
committerTom Lane
Wed, 11 Oct 2017 20:57:14 +0000 (16:57 -0400)
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[email protected]

doc/src/sgml/ref/grant.sgml
src/backend/utils/adt/acl.c

index 8f385f6bb757ce0333cc55ed60d85a87605d4790..385cfe6a9cab4f2824198a6f7ce26a69f3fc0a16 100644 (file)
@@ -156,12 +156,22 @@ GRANT role_name [, ...] TO 
   
    PostgreSQL grants default privileges on some types of objects to
    PUBLIC.  No privileges are granted to
-   PUBLIC by default on tables,
-   columns, schemas or tablespaces. For other types, the default privileges
+   PUBLIC by default on
+   tables,
+   table columns,
+   sequences,
+   foreign data wrappers,
+   foreign servers,
+   large objects,
+   schemas,
+   or tablespaces.
+   For other types of objects, the default privileges
    granted to PUBLIC are as follows:
-   CONNECT and CREATE TEMP TABLE for
-   databases; EXECUTE privilege for functions; and
-   USAGE privilege for languages.
+   CONNECT and TEMPORARY (create
+   temporary tables) privileges for databases;
+   EXECUTE privilege for functions; and
+   USAGE privilege for languages and data types
+   (including domains).
    The object owner can, of course, REVOKE
    both default and  expressly granted privileges. (For maximum
    security, issue the REVOKE in the same transaction that
index 0c26e44d820507221e16a75f24dc05e73c72ccba..fa6b792d008cd801bbbb65265b8a10fd13903a41 100644 (file)
@@ -737,7 +737,9 @@ hash_aclitem_extended(PG_FUNCTION_ARGS)
  * acldefault()  --- create an ACL describing default access permissions
  *
  * Change this routine if you want to alter the default access policy for
- * newly-created objects (or any object with a NULL acl entry).
+ * newly-created objects (or any object with a NULL acl entry).  When
+ * you make a change here, don't forget to update the GRANT man page,
+ * which explains all the default permissions.
  *
  * Note that these are the hard-wired "defaults" that are used in the
  * absence of any pg_default_acl entry.