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 1qz9nr-00E6dT-LJ for pgsql-hackers@arkaria.postgresql.org; Sat, 04 Nov 2023 06:06:39 +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 1qz9mq-00588N-9x for pgsql-hackers@arkaria.postgresql.org; Sat, 04 Nov 2023 06:05:36 +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 1qz9mp-00588F-Sh for pgsql-hackers@lists.postgresql.org; Sat, 04 Nov 2023 06:05:35 +0000 Received: from mail-lj1-x231.google.com ([2a00:1450:4864:20::231]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qz9mm-003siO-Jc for pgsql-hackers@lists.postgresql.org; Sat, 04 Nov 2023 06:05:34 +0000 Received: by mail-lj1-x231.google.com with SMTP id 38308e7fff4ca-2c50906f941so39068871fa.2 for ; Fri, 03 Nov 2023 23:05:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20230601.gappssmtp.com; s=20230601; t=1699077930; x=1699682730; darn=lists.postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=Jh2qGA18cxEkJejJ+nfaZI5FraUFNrglOFPgYqt8FWo=; b=PcZlUr5bxQeZEBWaay2hjb0hhXFEN0OB7hyr8zwElr7F6iYalBYWHEMtNBNbkOEQVL bBrT3sOgZLxmVClSb7H6jlgz7Dl0s3VlSS2/To7TbAnVvumr0cFIJZgcQkFvKjkAoUzd QNXF4b8WiwW/hd1PAonmOZ+uT5hrKR57/EfMJ5Bb62lkL9pcjtUkPTUHHAwQyX/dYUhJ zI/e+bLZgzN9Da9AhWXdc+Db17nVVKPW1MFopXeui/gF82UA3cIdceiDyhvsZ63y4UcY QnJZzJnrs1MVTAW77yH+bDfl5pFfxrXRlDFiaNWmE24c3Vpk3Gh5Q3npQbUqCVqxT8PS YEAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699077930; x=1699682730; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=Jh2qGA18cxEkJejJ+nfaZI5FraUFNrglOFPgYqt8FWo=; b=aWFTu92zsFQXLoO8lPSckZB+j93qwEtZhGbx8w7iywk6ZskE5f1G+SXE45PYHbNFzI omKQxjCp1DmouGbRGY4hzs2xuVbelklH71iXUZp2cBG/TYnaK7/ZFJmb0JVHgKvYzJ3g I6J2hnl0uQZx1SY0CN5ab8O0kuimyPLE4pWJWgefNzaneqYZi3GdEP1T3/7H1uXPaYOt cdneFibLEcFGFrRwIfZuTpzdsA6hmdxsgKqpyqTywmDENtOYEVA1wFkjtlRQM9rYGmYj dCTkcMGcm7SEwPGOZHnPfko3HbborCNL5hTqZmpdyPuGN7RpKDvwryrhN3LVJ0Fy+xQu R60g== X-Gm-Message-State: AOJu0YyaIPO06BsSmORmTGzFnh68t+rd15jwQUAWHyKf4vpK84ETCrcP puNSQoc+b2x1b832/fRY4hE8Dm2+k1G3V0Fgum4= X-Google-Smtp-Source: AGHT+IFjr98V5cOwuvPAB/A1z4oskWJDVLqXnOSOcQeteTCfBhTSpxMjBKEk/L59CJMc684BlOaQSA== X-Received: by 2002:a05:651c:210f:b0:2be:58f3:ccee with SMTP id a15-20020a05651c210f00b002be58f3cceemr22741069ljq.41.1699077929743; Fri, 03 Nov 2023 23:05:29 -0700 (PDT) Received: from localhost.localdomain ([2001:871:260:349a:57ab:e7ee:d613:d164]) by smtp.gmail.com with ESMTPSA id fj12-20020a05600c0c8c00b004094c5d92bdsm4796419wmb.31.2023.11.03.23.05.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Nov 2023 23:05:29 -0700 (PDT) Message-ID: Subject: Re: Version 14/15 documentation Section "Alter Default Privileges" From: Laurenz Albe To: Bruce Momjian , Michael Banck Cc: David Burns , pgsql-hackers@lists.postgresql.org Date: Sat, 04 Nov 2023 07:05:28 +0100 In-Reply-To: References: <4a6f157edc4ae38a2050a5893e6729cbb98113bc.camel@cybertec.at> <653b841d.a70a0220.17f72.2c12@mx.google.com> <7de5f33f49a91d7b30b8c01fe46fc280713ebae1.camel@cybertec.at> <653cce08.050a0220.a10fb.7878@mx.google.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.48.4 (3.48.4-1.fc38) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, 2023-11-03 at 12:53 -0400, Bruce Momjian wrote: > I have developed the attached patch on top of the alter default patch I > just applied. It is more radical, making FOR ROLE clearer, and also > moving my new FOR ROLE text up to the first paragraph, and reordering > the paragraphs to be clearer. >=20 > I think this is too radical for backpatch to 11/12, but I think > 16/master makes sense after the minor releases next week. I think it is a good idea to move part of the text to a new paragraph. > --- a/doc/src/sgml/ref/alter_default_privileges.sgml > +++ b/doc/src/sgml/ref/alter_default_privileges.sgml > @@ -90,23 +90,14 @@ REVOKE [ GRANT OPTION FOR ] > [...] > + As a non-superuser, you can change default privileges only for yourse= lf > + and for roles that you are a member of. These privileges are not > + inherited, so member roles must use SET ROLE to > + access these privileges, or ALTER DEFAULT PRIVILEGES > + must be run for each member role. Privileges can be set globally > + (i.e., for all objects created in the current database), or just for > + objects created in specified schemas. That this paragraph is not clear enough about who gets the privileges and who creates the objects, and that is one of the difficulties in understandi= ng ALTER DEFAULT PRIVILEGES. Perhaps: ALTER DEFAULT PRIVILEGES allows you to set the privile= ges that will be applied to objects created in the future. (It does not affect privileges assigned to already-existing objects.) Privileges can= be set globally (i.e., for all objects created in the current database), or just for objects created in specified schemas. As a non-superuser, you can change default privileges only on objects cre= ated by yourself or by roles that you are a member of. If you alter the defau= lt privileges for a role, only objects created by that role will be affected= . It is not sufficient to be a member of that role; member roles must use SET ROLE to assume the identity of the role for which default privileges were altered. There is no way to change the default privileges for objects created by any role. You have run ALTER DEFAULT PRIVILEGES for a= ll roles that can create objects whose default privileges should be modified= . > @@ -136,12 +140,9 @@ REVOKE [ GRANT OPTION FOR ] > target_role > > > - The name of an existing role of which the current role is a member= . > - Default access privileges are not inherited, so member roles > - must use SET ROLE to access these privileges, > - or ALTER DEFAULT PRIVILEGES must be run for > - each member role. If FOR ROLE is omitted, > - the current role is assumed. > + If FOR ROLE is specified, this is the role that > + will be assigned the new default privileges, or the current role > + if not specified. This is downright wrong; the "target_role" will *not* be assigned any privileges. Perhaps: Default privileges are changed only for objects created by target_role. If FOR ROLE is omitted, the current role is assumed. Yours, Laurenz Albe