Re: SQL command : ALTER DATABASE OWNER TO

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
Cc: gparc(at)free(dot)fr, Daniel Gustafsson <daniel(at)yesql(dot)se>, pgsql-docs <pgsql-docs(at)lists(dot)postgresql(dot)org>
Subject: Re: SQL command : ALTER DATABASE OWNER TO
Date: 2024-01-24 15:47:06
Message-ID: CAKFQuwZjb=umdSBrW5diWDbXU25ygFzTKUON2TnfRdXmt9pjTg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

On Wed, Jan 24, 2024 at 8:35 AM Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
wrote:

> On Wed, 2024-01-24 at 15:40 +0100, gparc(at)free(dot)fr wrote:
> > maybe a misunderstanding of my part, but your proposed modification
> doesn't matched
> > with the current behaviour of the command as precisely the object
> privileges of the old owner are **NOT** transferred
> > to the new owner along with the ownership
>
> But that is what happens.
>
> The permissions are transferred to the new owner, so the old owner doesn't
> have any privileges on the object (and, in your case, cannot connect to
> the database any more).
>
>
I dislike this change, ownership of an object is completely independent of
the grant system of privileges. The granted privileges of the old row do
not transfer to the new owner when alter ... owner to is executed. The
separate object attribute "owner" is the only thing that changes. If the
old owner doesn't have any granted privileges on the modified object then
they will be left with no ability to interact with that object. In the
case of Database the applicable interactions are Create and Connect. The
permissions the old owner may have on any other objects in the database are
also left unaffected - such as those on a schema. But if they have lost
the ability to Connect then actually exercising schema privileges becomes
impossible. It really isn't any different than removing their login
attribute.

Note that since PUBLIC gets connect privileges on all databases by
default...

David J.

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Laurenz Albe 2024-01-24 16:13:01 Re: SQL command : ALTER DATABASE OWNER TO
Previous Message Alvaro Herrera 2024-01-24 15:37:49 Re: Spam complaint