Re: BUG #16124: Altering default privileges problem - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #16124: Altering default privileges problem
Date
Msg-id 32466.1574091081@sss.pgh.pa.us
Whole thread Raw
In response to BUG #16124: Altering default privileges problem  (PG Bug reporting form <noreply@postgresql.org>)
List pgsql-bugs
PG Bug reporting form <noreply@postgresql.org> writes:
> Bug reference:      16124
> Logged by:          John Doe
> Email address:      john.doe@example.com

... so, effectively an anonymous report.  Hope the submitter reads
pgsql-bugs, else he'll get no answer.

> Altering default privileges in specific schema to revoke all privileges on
> types from PUBLIC does nothing.

AFAICT, this is operating as designed.  SetDefaultACL() says:

     * The default for a global entry is the hard-wired default ACL for the
     * particular object type.  The default for non-global entries is an empty
     * ACL.  This must be so because global entries replace the hard-wired
     * defaults, while others are added on.

Hence, "ALTER ... IN SCHEMA whatever REVOKE ALL PRIVILEGES ON TYPES FROM
PUBLIC" is a no-op because the privilege was never granted at the schema
level in the first place.

This seems kind of unfortunate, and it's certainly not adequately
documented.  The man page does say "Default privileges that are specified
per-schema are added to whatever the global default privileges are for the
particular object type" but the implication that you can't revoke
privileges at that level isn't obvious.

I don't see any way to change the actual behavior, at least not within the
existing representation of pg_default_acl, but we ought to improve the
documentation.  I'm inclined to split out the just-quoted sentence to
a new para along the lines of

    Default privileges that are specified per-schema are added to whatever
    the global default privileges are for the particular object type.
    This means you cannot revoke privileges per-schema if they are granted
    globally (either by default, or according to a previous ALTER DEFAULT
    PRIVILEGES command that did not specify a schema).  Per-schema REVOKE
    is only useful to reverse the effects of a previous per-schema GRANT.

Perhaps an explicit example too?

            regards, tom lane



pgsql-bugs by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #16124: Altering default privileges problem
Next
From: Tom Lane
Date:
Subject: Re: BUG #16121: 12 regression: Volatile function in target list subquery behave as stable