2
votes

The documentation for GRANT says:

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 granted to PUBLIC are as follows: CONNECT and CREATE TEMP TABLE for databases; EXECUTE privilege for functions; and USAGE privilege for languages.

Types aren't mentioned as getting default privileges, so why do I see the following:

> CREATE TYPE bug_status AS ENUM ('new', 'open', 'closed');
> REVOKE USAGE ON TYPE bug_status FROM postgres;
> \dT+ bug_status
                                        List of data types
 Schema |    Name    | Internal name | Size | Elements | Owner    | Access privileges | Description
--------+------------+---------------+------+----------+----------+-------------------+-------------
 public | bug_status | bug_status    | 4    | new     +| postgres | =U/postgres       |
        |            |               |      | open    +|          |                   |
        |            |               |      | closed   |          |                   |

I have revoked USAGE from the owner, but PUBLIC has the privilege.

Am I missing where this is documented?

1

1 Answers

2
votes

You are right; it looks like PUBLIC is granted the USAGE privilege by default.

This is a documentation bug, I'll do something about it.

EDIT: The bug is fixed with this PostgreSQL commit.