Re: How to delete default privileges

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: Francisco Reyes <lists(at)natserv(dot)net>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to delete default privileges
Date: 2017-08-15 22:26:26
Message-ID: CAMkU=1wi-XF4CQ+6V==ADHLfB4rj7gVC5m4ku2Lcn-=YZ+eFew@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Aug 15, 2017 at 3:02 PM, Francisco Reyes <lists(at)natserv(dot)net> wrote:

> I have a DB where we changed ownership of all objects.
>
> We had:
>
> ALTER DEFAULT PRIVILEGES FOR ROLE old_dbowner GRANT SELECT ON tables TO
> dbgroup_ro_group;
> ALTER DEFAULT PRIVILEGES FOR ROLE old_dbowner GRANT SELECT ON sequences TO
> dbgroup_ro_group;
>
> ALTER DEFAULT PRIVILEGES FOR ROLE old_dbowner GRANT SELECT, UPDATE,
> DELETE, INSERT ON tables TO dbgroup_rw_group;
> ALTER DEFAULT PRIVILEGES FOR ROLE old_dbowner GRANT SELECT, USAGE
> ON sequences TO dbgroup_rw_group;
> ALTER DEFAULT PRIVILEGES FOR ROLE old_dbowner GRANT EXECUTE
> ON functions TO dbgroup_rw_group;
>
>
> But now there is a new DB owner and I have run the above, but with
> new_dbowner. How can I delete the old default grants? Can't find examples
> and don't see it on the documentation either.
>
>
> Any help would be greatly appreciated.

You just reverse them, changing GRANT...TO into REVOKE...FROM. When the
altered-default is the same thing as the default-default, then the
altered-default disappears.

Cheers,

Jeff

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Michael Paquier 2017-08-16 05:05:09 Re: WAL replication wrong collate
Previous Message Francisco Reyes 2017-08-15 22:02:09 How to delete default privileges