Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rSfTh-00F9ab-EZ for pgsql-docs@arkaria.postgresql.org; Wed, 24 Jan 2024 15:47:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rSfTg-005zoI-HW for pgsql-docs@arkaria.postgresql.org; Wed, 24 Jan 2024 15:47:48 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rSfTg-005zo1-7C for pgsql-docs@lists.postgresql.org; Wed, 24 Jan 2024 15:47:48 +0000 Received: from mail-oo1-xc2b.google.com ([2607:f8b0:4864:20::c2b]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rSfTc-0039N9-UE for pgsql-docs@lists.postgresql.org; Wed, 24 Jan 2024 15:47:46 +0000 Received: by mail-oo1-xc2b.google.com with SMTP id 006d021491bc7-595aa5b1fe0so3576803eaf.2 for ; Wed, 24 Jan 2024 07:47:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706111264; x=1706716064; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=1F86vIIzSFHH09h592oT/UKIhSERk++WUnBEX1VySNY=; b=M0sSDG981bc1xlTlA5xvW3EgOyVH32g219ZsHhloo50c8/R6ae9/AInGtUu1wzacxT yRFlvgjOba+Feb7TzWfkdeaSRNE6ptKHoPgucD9UUP6IMxhRe1pd16s2TLNDDri2Lipw nKJm9wDlg0jspjEfynum6CcDnqbBniWIkUfxUb4HMKnF7oQI4z4uHvYRtHmerFBjwZBB eDIt0yWFrqt0YeF1M+kz4kmHiBV1tCp5t6t1i+X1afJy3EJFT88GKw8HirXL5iTidI8b 9uvCt5YGiLgN73J0v+qJ23L4bemgXDZmbC18lxqrdLuh+fzc7FStWCmRa0th2aXJQNFA ucXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706111264; x=1706716064; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=1F86vIIzSFHH09h592oT/UKIhSERk++WUnBEX1VySNY=; b=Jq9R30oH9cZWLb6mM4fBvb5Qd+nushSItrbMBlcGNF3M2snZa/IzAQjy/vCriY3QOE 87FESW8li3r/ALdFcFl8qNS9qTkRlmF22i/RM17RDF6+qB2B4jJfbU+PFvnVOqIRBidD XulAflH05axFLdzWLA61vZOpTMpJxKg+9MPNTmiExZKgNy03jOUNt2d4T7sJgOYavo44 idJTAUBWjv21o//h+oIXQ0XovDvsRbEUp0PxWFmsY17IVgzAmicstkscY9/21ZhFqqiI 1Nev+se1v+bE9dX5SAc+IRVD/GRH2g5Djd4D6EyQwfNaP92CRd+4yY79Pfaarv1Q3Rw3 RmCA== X-Gm-Message-State: AOJu0YxTgjU+4/vNqpDZDWCyYPo/OlKOJjbcY1hXLUjhHxzw9uIdMEJm BvZvziJFxHBGnJWxwJJ9ByhoqDmzv5WyxL3/TXvQx7wSXXJxWN1zyQ7ngwNTafAvby6uY2HGK7n WrbwCN8LV8OP1+r4y+5ry8Qd6fJU= X-Google-Smtp-Source: AGHT+IFs34IJBFUxwvBCkPhrDjBZUvQs/m+gRi5ii2UBsypGuilWGMCaE1CXy5V/Lofxy52VifkfgikOLBbhMpQHt30= X-Received: by 2002:a4a:d853:0:b0:599:b519:5f20 with SMTP id g19-20020a4ad853000000b00599b5195f20mr1474105oov.2.1706111264156; Wed, 24 Jan 2024 07:47:44 -0800 (PST) MIME-Version: 1.0 References: <2023185982.281851219.1646733038464.JavaMail.root@zimbra15-e2.priv.proxad.net> <1712096587.208766558.1706090901073.JavaMail.zimbra@free.fr> <1327973565.212682013.1706107220766.JavaMail.zimbra@free.fr> In-Reply-To: From: "David G. Johnston" Date: Wed, 24 Jan 2024 08:47:06 -0700 Message-ID: Subject: Re: SQL command : ALTER DATABASE OWNER TO To: Laurenz Albe Cc: gparc@free.fr, Daniel Gustafsson , pgsql-docs Content-Type: multipart/alternative; boundary="000000000000d8f0a7060fb2fb3c" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000d8f0a7060fb2fb3c Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Jan 24, 2024 at 8:35=E2=80=AFAM Laurenz Albe wrote: > On Wed, 2024-01-24 at 15:40 +0100, gparc@free.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. --000000000000d8f0a7060fb2fb3c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Wed, Jan 24, 2024 at 8:35=E2=80=AFAM Laurenz Albe <<= a href=3D"mailto:laurenz.albe@cybertec.at">laurenz.albe@cybertec.at>= wrote:
On Wed, 2024-01-24 at 15:40 +0100, gparc@free.fr wrote:
> maybe a misunderstanding of my part, but your proposed modification do= esn't matched
> with the current behaviour of the command as precisely the object priv= ileges 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= 9;t
have any privileges on the object (and, in your case, cannot connect to
the database any more).


I disli= ke this change, ownership of an object is completely independent of the gra= nt system of privileges.=C2=A0 The granted privileges of the old row do not= transfer to the new owner when alter ... owner=C2=A0to is executed.=C2=A0 = The separate object attribute "owner" is the only thing that chan= ges.=C2=A0 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 tha= t object.=C2=A0 In the case of Database the applicable interactions are Cre= ate and Connect.=C2=A0 The permissions the old owner may have on any other = objects in the database are also left unaffected - such as those on a schem= a.=C2=A0 But if they have lost the ability to Connect then actually exercis= ing schema privileges becomes impossible.=C2=A0 It really isn't any dif= ferent than removing their login attribute.

Note that = since PUBLIC gets=C2=A0connect=C2=A0privileges on all databases by default.= ..

David J.

--000000000000d8f0a7060fb2fb3c--