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 1vFbpr-00Ee2A-0C for pgsql-docs@arkaria.postgresql.org; Sun, 02 Nov 2025 17:25:46 +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 1vFbpo-00Cf6N-OP for pgsql-docs@arkaria.postgresql.org; Sun, 02 Nov 2025 17:25:43 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1vFbpo-00Cf6F-Eo for pgsql-docs@lists.postgresql.org; Sun, 02 Nov 2025 17:25:43 +0000 Received: from mail-oi1-x22c.google.com ([2607:f8b0:4864:20::22c]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vFbpk-005bcr-1P for pgsql-docs@lists.postgresql.org; Sun, 02 Nov 2025 17:25:42 +0000 Received: by mail-oi1-x22c.google.com with SMTP id 5614622812f47-44fa8d1b80bso574474b6e.1 for ; Sun, 02 Nov 2025 09:25:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1762104338; x=1762709138; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Ey8K5Zj7g5mllGGSFsWeTif/kC+KH6zyAPv1B/v/jBk=; b=PIlqYALFzv2PFQan/4uC8ZpUBXpbW55VIxE/jgExFqdL8SIgKLroJctSD34BrowBd/ 5SV0aKt4XwQsiDA/KzKk/1duwZyl+pwkEDPSVLPoeONRDGS5RC/AESK2zQcsn9VMlCWt F/jKaE3IRDZHtWusJAwo+RPxoaaeQHoYXU2I96i49i0DS8xSiaZIzk9MOIRHkP/6QgAt a/ckS361KPPCph1eMkN0vrr2AI3s1gV7mPc02/m+nRJ39pjWOLOnX0LwyC6WZYWBj4iQ B/gV/DKUo7XB8ad0qe3rpexFVixr/Ag3zlWSLD3Ewy/21JDlwqsnRwGcTMvCVlhmVL5K xGtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762104338; x=1762709138; h=content-transfer-encoding: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=Ey8K5Zj7g5mllGGSFsWeTif/kC+KH6zyAPv1B/v/jBk=; b=g4z1kIbEBd6Ww+HYGuixnF6NcxcFUO6a4K6HoFFam4IUFya1iM0wfsRacFkz+/dq0i cMcOZR8TSnGIDKukVx3Rw4eNUs6MQCAU2S7d8t7CMh40VHkwPOUsbLJc2gc8UWsM+WbI aAWoY70REFXXlsZcv2URJoOySqWbPCvKgLOn7JM06fnuWDl8cnXRoFpZWw4vwiTCn69A vjwQGvQOjI0br5FeFT075n+QEGHDjkEobst0ffPjxUZUH2p2gRvj3tCp7JQt1X1bBWlw cd9/D7eWIPOj8UDcavc1h+knh6uQDB91SB7tbFgqKjc6Ro6Zmfxj0sLFRvIdF5klAqdw 3xoQ== X-Forwarded-Encrypted: i=1; AJvYcCVS7MoYWDzd8SV3E0SPsb+88D3+a93MxNkMhJJnXbJjrmF0gpI5igBQP9+ES4Xp6sw1NOlPZkwJfC08@lists.postgresql.org X-Gm-Message-State: AOJu0YwexZyoSlJ4mBevOXUNvQW0jTCkGXJUus/4uiSemGl+IPxS2T11 goY3n8GrBUsZdSqIhLj0v4nOhBFGr8ufJGQfR0ufxioccQTP2vj7YMJoxf6SoRyncyuEoq9YfOi JRsygA+O+mpgaXKRE49LabVm59aVWcsM= X-Gm-Gg: ASbGncuKzKNNklV3JpEuQ+6xcGCoVKCP2f4h7RWtdXI6o47PMPTAs6Y7Rqt9OXsffrx cS6hZBoKF5Ybid2x+zoEnSfjk0NjN4KoyFHXNZckXD0MwUOmILqQbrBX8Jih6UyP34DKjBtKlcd vWoU+a/Qh/uroTKPmLIBwTOSEy4oX+eDnqae6gniBgSO/Skgl6pt1W3OyMQdA03dCJU+Bwosph5 ciz4iitcWjJowycjKYT9cwjrst5LLhwZ77y5iuWaZ0lSrI/zv7GRf56mQcma45MGrkLdpPJ87Yc qPZvY++PyzS/6o0bTMdPrARWgG3eQlLtWCIpnvhRJoL9f8lOV11Jlh8TzB8MUQ== X-Google-Smtp-Source: AGHT+IEzvwXTLD3k9B4w7GzO10xzW/wysNDA0yihbx5V/sZ6DiGbUGN7lVDAIyJGA5qG1A9CT8wA1iUXEPz7ht/vZAU= X-Received: by 2002:a05:6808:d4d:b0:438:39a2:b61c with SMTP id 5614622812f47-44f95dfb174mr4399874b6e.2.1762104338096; Sun, 02 Nov 2025 09:25:38 -0800 (PST) MIME-Version: 1.0 References: <2023185982.281851219.1646733038464.JavaMail.root@zimbra15-e2.priv.proxad.net> <1712096587.208766558.1706090901073.JavaMail.zimbra@free.fr> <0a933e91f59b59f14734e19e8575894a2a06a7f2.camel@cybertec.at> In-Reply-To: <0a933e91f59b59f14734e19e8575894a2a06a7f2.camel@cybertec.at> From: =?UTF-8?B?Sm9zZWYgxaBpbcOhbmVr?= Date: Sun, 2 Nov 2025 18:25:01 +0100 X-Gm-Features: AWmQ_blfzcZtD_AkElTJcWGSeZ3I1EdT5NOqNJGrea0_ARBS-82o-iGc4Lc295g Message-ID: Subject: Re: SQL command : ALTER DATABASE OWNER TO To: Laurenz Albe Cc: Daniel Gustafsson , gparc@free.fr, pgsql-docs Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk ne 2. 11. 2025 v 18:23 odes=C3=ADlatel Laurenz Albe napsal: > > On Wed, 2024-01-24 at 15:26 +0100, Daniel Gustafsson wrote: > > > On 24 Jan 2024, at 15:23, Laurenz Albe wro= te: > > > > > > On Wed, 2024-01-24 at 11:08 +0100, gparc@free.fr wrote: > > > > for this "ALTER DATABASE" form, it should be mentioned that after e= xecution of the command, > > > > the old database owner loses all his privileges on it (even connect= ion) although it might > > > > still owns schemas or objects (tables, index,...) inside it. > > > > > > > > Thanks in advance to add this important precision. > > > > > > How about this: > > > > > > diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml > > > index 4044f0908f..44042f863c 100644 > > > --- a/doc/src/sgml/ddl.sgml > > > +++ b/doc/src/sgml/ddl.sgml > > > @@ -1891,6 +1891,8 @@ ALTER TABLE table_name OWNER TO new_owne > > > Superusers can always do this; ordinary roles can only do it if th= ey are > > > both the current owner of the object (or inherit the privileges of= the > > > owning role) and able to SET ROLE to the new ow= ning role. > > > + All object privileges of the old owner are transferred to the new= owner > > > + along with the ownership. > > > > > > > Doesn't seem unreasonable to me, it won't make the docs harder to read = and use > > for experienced users while it may make them easier to follow for new u= sers. > > Here is a patch for this change. Did a quick test: during review retro=3D# CREATE USER josef; CREATE DATABASE testdb OWNER josef; GRANT ALL ON DATABASE testdb TO josef; CREATE ROLE CREATE DATABASE GRANT retro=3D# \l testdb List of databases Name | Owner | Encoding | Locale Provider | Collate | Ctype | ICU Locale | ICU Rules | Access privileges --------+-------+----------+-----------------+-------------+-------------+-= -----------+-----------+------------------- testdb | josef | UTF8 | libc | cs_CZ.UTF-8 | cs_CZ.UTF-8 | | | =3DTc/josef + | | | | | | | | josef=3DCTc/josef (1 row) retro=3D# ALTER DATABASE testdb OWNER TO retro; ALTER DATABASE retro=3D# \l testdb List of databases Name | Owner | Encoding | Locale Provider | Collate | Ctype | ICU Locale | ICU Rules | Access privileges --------+-------+----------+-----------------+-------------+-------------+-= -----------+-----------+------------------- testdb | retro | UTF8 | libc | cs_CZ.UTF-8 | cs_CZ.UTF-8 | | | =3DTc/retro + | | | | | | | | retro=3DCTc/retro (1 row) It works exactly as described in this patch. +1 > Yours, > Laurenz Albe