Re: SQL command : ALTER DATABASE OWNER TO

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: gparc(at)free(dot)fr, Pg Docs <pgsql-docs(at)lists(dot)postgresql(dot)org>
Subject: Re: SQL command : ALTER DATABASE OWNER TO
Date: 2022-03-08 15:06:53
Message-ID: CAKFQuwYMUq=Fa3gqMDUrd6yuUzmnyJSdFEiTDk-mQMS986jMvQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

On Tue, Mar 8, 2022 at 7:39 AM Bruce Momjian <bruce(at)momjian(dot)us> wrote:

> On Tue, Mar 8, 2022 at 10:50:38AM +0100, gparc(at)free(dot)fr wrote:
> >
> > Hello,
> >
> > for this "ALTER DATABASE" form, it should be mentioned that after
> execution of the command,
> > the old database owner loses all his privileges on it (even connection)
> although it might
> > still owns schemas or objects (tables, index,...) inside it.
> >
> > Thanks in advance to add this important precision.
>
> Uh, the original owner is not the owner anymore, so why would they
> assume they can reconnect, unless there is some other permission
> specified for them.
>
>
Agreed. The proposed solution simply addresses a single symptom of what
may be a misunderstanding about how the system works (i.e., that an object
can only have a single owner, and, each privilege is specific to an object
and does not confer any implied privileges on container objects - schemas
and databases namely).

If there is a suggestion to improve the core misunderstandings that is
something to consider. Ideally in a central place about permissions in
general and not in the specific ALTER DATABASE command.

Given that the default behavior of PostgreSQL is to grant CONNECT via
PUBLIC, removing ownership of a database from a role does not, by default,
remove their connect privilege.

David J.

In response to

Browse pgsql-docs by date

  From Date Subject
Next Message PG Doc comments form 2022-03-08 15:32:23 Missing information about CREATE TRIGGER on temporary tables
Previous Message Bruce Momjian 2022-03-08 14:39:11 Re: SQL command : ALTER DATABASE OWNER TO