How are “DEFAULT PRIVILEGES” implemented in Postgresql?

Posted on

Question :

If I create a new database cluster (via initdb), then create a new database. How are the “default privileges” and “global default privileges” implemented?

For example, when I run ddp in psql, it shows no rows. Does this mean ALTER DEFAULT PRIVILEGES adds/removes rows in a table somewhere?

Answer :

information_schema is an ANSI-standard set of read-only views. You can easily learn what that views actual query are by reading the code which is here. The real catalog information is stored in System Catalogs.

As documentation says ‘There is no ALTER DEFAULT PRIVILEGES statement in the SQL standard.’ So there shouldn’t be anything related to information_schema.

Your records should be stored in pg_default_acl which stores initial privileges to be assigned to newly created objects.

Leave a Reply

Your email address will not be published. Required fields are marked *