Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1htG83-0007kn-Sc for pgsql-docs@arkaria.postgresql.org; Thu, 01 Aug 2019 18:48:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1htG81-0007e7-Pa for pgsql-docs@arkaria.postgresql.org; Thu, 01 Aug 2019 18:48:41 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1htG81-0007Yn-6M for pgsql-docs@lists.postgresql.org; Thu, 01 Aug 2019 18:48:41 +0000 Received: from mail-yb1-xb41.google.com ([2607:f8b0:4864:20::b41]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1htG7x-0004QT-F5 for pgsql-docs@lists.postgresql.org; Thu, 01 Aug 2019 18:48:40 +0000 Received: by mail-yb1-xb41.google.com with SMTP id c202so24676911ybf.0 for ; Thu, 01 Aug 2019 11:48:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joeconway.com; s=google; h=subject:from:to:references:openpgp:autocrypt:message-id:date :user-agent:mime-version:in-reply-to; bh=CaxJpDXV6loetRxF3gohhV1HkZwsHfUuqH0LbF0kZcE=; b=E2Devqk9N9dDe5Ot8nJzWzK9FimXlNKpwarFlydNyz4JlL8Aqi1NPMWuU1z07Ef4cy 3aV6g7i0CJt6ESRganU8pIGLfQBZFy1/4KIsbTwSsMnSDreINfglu3JkyZtl//ZRN2mG 06C9dVnvXVMdL2Yb/Fyx2YR8OqGKPUAnxXDV4oYK9P5gpQoeAul+S5HNV7it7f1wZGXr nBGHAGAX66AV9CeSkuDuBvdiyTlWZg55rwIIKNYKBm2YEmC23LNfF9jID38IJrZqDcJf wKWfwHdn5tXEI963tnoEmZy8EidBP5xQxH9xo+tKH/ZPmAi/p0SStGb595RlrinoXN44 jPww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:references:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to; bh=CaxJpDXV6loetRxF3gohhV1HkZwsHfUuqH0LbF0kZcE=; b=KKZ6CI18o9VQoOY3shAXTKpOykpQW+nVqOsijVuR925slVM6ZTHWFF0e/hjRbUpYvo dwMFvltxhpJh1qtifWc0eaYnAYI4LVQu0/RqQQvYGbk1G93ZZpmUR8qgAi5g9kZpblXg BgHMVEDlZXqGrsvs1hqPJnvZWGUMB7oSiBt/HqOqf2PPtZyukNjkfoWBjBUuOp2UKNDL c1uN2D72ygQSbvBoh7N/kJ8TRqhWnf0OcBmxowPsjpWt8Yqb/429gPnIFpCciv47W7hZ eYqcSYNsQIpjb2/yPLbbQ/bnykoNeka3bwCqt+nrWuVUo9+hrHUOrLxdLastIxccObeX gxjA== X-Gm-Message-State: APjAAAXsfBfQpTPkTitukGdCmtvRJBOcgQJw8DpUgCQMmoFPPWh/K6j9 0SmpxOs0lmhIZen6tZgzwmDI9DTuPFY= X-Google-Smtp-Source: APXvYqxjWQlpVTr/eCOSMCaEtZslCHUhgqfzxo2HdLz1ebo+TpYGOxcwfl8fkPjcgk8ikl4/hiLNeA== X-Received: by 2002:a25:374a:: with SMTP id e71mr65893565yba.0.1564685313872; Thu, 01 Aug 2019 11:48:33 -0700 (PDT) Received: from [192.168.4.41] ([72.17.18.98]) by smtp.gmail.com with ESMTPSA id i84sm17543528ywi.0.2019.08.01.11.48.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Aug 2019 11:48:31 -0700 (PDT) Subject: Re: SET ROLE documentation not entirely correct From: Joe Conway To: Steven Winfield , "pgsql-docs@lists.postgresql.org" References: <155603476764.1372.10888362840885095061@wrigleys.postgresql.org> <03796ce5-8366-cd32-0436-9981ffbeb993@joeconway.com> Openpgp: preference=signencrypt Autocrypt: addr=mail@joeconway.com; keydata= mQINBEpXMCsBEADDnXUQzjlyi/cX02Gtdy2CLcroE5CsC7DJKdOBDbfgn0kfiIYoV5JniG4l VyzZUodY8yUAagqLYolh0UkBzs9N+qkm7erde4ypw3jzVQ37BuzIvk3nMUbuDZDgxWqX+nVS sKc+BQ5BpzgCHg48leoRO2ohjvYnUhgH3j2rFZCzaj6qQ7mv+XoxOJmUlVQtG06Jwkk7Vu14 7U9nMMM6hyUKzVnmCphnlcMNo26UyVU70MwFfFJgcI0c5fpp8byN56eD6VJVnufO5WAuEhzE qcrSJR2FAlmM90GBY+6vP29twLDCHuSFvrnujNCx/BvCC/a3/gPvyAFp4JtMm9eXAmq3m/Kw 94nTJXVdcbQeQQDp3KIG7MmWS4lnGvPn8v0CjgNaLvZXFLo1FgmUVsyEq1Lww4iRLa6sbpXJ ESx15UEue1k1YZM9C+4F/o3aeKNsAienjw2EXFzcaxIg/C4P493VMi3Qa8ycVxR5iYhUbYdo DFIUQhbFNsYfrtW/qZAELT3FCYFpZYG01e9Hj+cBrXXgyDDkQ5Lq4mlvmkRvuxn61V6Au4HA 0sJiCox5pM1FvzT+aI8HY1BYaiB9Pl4fhpKgmhhlSuglk9v39S4jmlUIb45iLAUVpeNM6Qjm 69pf5da9sm4aGFa7YlDSKf/WcU7z9ITZxsilOi2n7YJiwG7kTQARAQABtB9Kb2UgQ29ud2F5 IDxtYWlsQGpvZWNvbndheS5jb20+iQI8BBMBAgAmAhsDBwsJCAcDAgEGFQgCCQoLBBYCAwEC HgECF4AFAlpoksUCGQEACgkQMyt+aLaZQ0p4XQ/9F4WSf4ZFuL3ae356ApVqnLxphHXeXHli ePZe7qosvXMQLN9Y2m5cQwqojsQh4pZujIi4Iwxw7ORg6HbMO8dMhyu8TlDavErcgO561hG7 /TCc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DrIQ+1RlIh6C2Z/eMipqJOT26+spluTjouvnKT0S5yOgyX 0PjbsysgwQdCGNJLHOjhHbSpSmOLaduV3CQo/0+DHT/TBjYfIXjTWouY9TkGxG4eNrxU0u2x Ay5bMqOPmsFdjLTWlQUlF/fTMhB54XwI3FHWgnSnXZzStDTmTebLNdT/ftgliAzA81uMj49j 0exv731/v+7udLA1bV8gnZ01zQCASDpWiRQR3fgwcugSUqgRABEBAAGJAh8EGAEIAAkFAkpX MicCGwwACgkQMyt+aLaZQ0pwAQ//bjcWnZg/jjRQ9gbZUGMqniItZYRglBMKIqt4Fia379Jm HwTvavnFkJ8XMZ56UB0FIrgS+sUkRH6cPRQR+7Qi392LD021DXgSsz9CwFHjFyBGHwLEOTRc fYQbtJy0shHDJB4aQTOX3ERDH1PsvJNuevmQMzS0DWFav9+xMz9rKP4N+HffoBIZE0C1xIE4 3nD4eLsbycte9sVIrmlNuUti3qUxJAQw8HwfJ6ZbBInHxquApR16uD1u99o6XlndFrDlY22t RmHCM0bR81GfGNdcU3Uo+rG/R/k4qa7s9/dgKvMbyH3fHhp/ceKag80Xo8IFurRl0ZJP3sHJ 2QDHCVLat7jRZ+43hi1WlIhFbrgn6IyI0i7XR/W8JjrC5MsKq4TUwGH077sU/kcHYebVJZRb UUst2hAGHDFVBcG12qoKf+ltL9qXJc1y7BGeCoUW6QjOpljpq6ZL4FQUsM0RSRjs5egE3szP cIf5SyPK6WDOApoAq6M7BBFMGDZwEylYMtr0YekA1u86UA9D2xwLHEbBBp/uiby1c9JbPJ1P n8zJP8WZNeRw4Q9TtqVK09+oLirMUSpIDd6KdZ1VgRxOK2re7tjDvkVuYsSrsiJ+1iJNEnp9 iK0ok0DlJpSCe6KhkxpaTdeoWMXdKuJWec0NIqoAd54ZgBPnr+UPxTixgPq/p6Q= Message-ID: <95864cbc-4548-2cc5-86de-2a41641ee9d1@joeconway.com> Date: Thu, 1 Aug 2019 14:48:30 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="qvRV9VQW6ozUELoQFzuo9e7dwOFsUrsza" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --qvRV9VQW6ozUELoQFzuo9e7dwOFsUrsza Content-Type: multipart/mixed; boundary="DzENM2QL7tST31SbNPKJRRacWhLRa9Gag"; protected-headers="v1" From: Joe Conway To: Steven Winfield , "pgsql-docs@lists.postgresql.org" Message-ID: <95864cbc-4548-2cc5-86de-2a41641ee9d1@joeconway.com> Subject: Re: SET ROLE documentation not entirely correct References: <155603476764.1372.10888362840885095061@wrigleys.postgresql.org> <03796ce5-8366-cd32-0436-9981ffbeb993@joeconway.com> In-Reply-To: --DzENM2QL7tST31SbNPKJRRacWhLRa9Gag Content-Type: multipart/mixed; boundary="------------011905E1D0D138C7CC38DD06" Content-Language: en-US This is a multi-part message in MIME format. --------------011905E1D0D138C7CC38DD06 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 4/27/19 4:02 PM, Joe Conway wrote: > On 4/25/19 11:25 AM, Steven Winfield wrote: >> Again, that's much clearer than what is currently there. It might help= >> if some of the language/definitions from pg_has_role() is used, though= =2E >>=20 >> For example: >> A role X is a "MEMBER" of another role Y if there is a chain of GRANTs= >> from X to Y via zero or more intermediate roles. This allows X to >> execute "SET ROLE Y". >> Additionally X has "USAGE" of Y if X and all the intermediate roles (b= ut >> *not* necessarily Y) are marked INHERIT. In this case X automatically >> has the privileges of Y, without the need to "SET ROLE Y". >=20 > I've been whacking this around for the better part of the afternoon and= > came up with the attached. I think it is correct, and better than my > previous proposal, but possibly need more polish. Comments welcome. I've been sitting on this change a while and want to get it pushed. Steven Winfield seemed happy with it -- any other comments before I commit? Also this seems like it ought to be back-patched, but any thoughts on that? Thanks, Joe --=20 Crunchy Data - http://crunchydata.com PostgreSQL Support for Secure Enterprises Consulting, Training, & Open Source Development --------------011905E1D0D138C7CC38DD06 Content-Type: text/x-patch; name="set-role-docs-00.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="set-role-docs-00.diff" diff --git a/doc/src/sgml/ref/set_role.sgml b/doc/src/sgml/ref/set_role.s= gml index 0ef6eb9..d219a1e 100644 *** a/doc/src/sgml/ref/set_role.sgml --- b/doc/src/sgml/ref/set_role.sgml *************** RESET ROLE *** 42,48 **** =20 The specified role_name ! must be a role that the current session user is a member of. (If the session user is a superuser, any role can be selected.) =20 --- 42,48 ---- =20 The specified role_name ! must be a role that the current session user is a MEMBER of. (If the session user is a superuser, any role can be selected.) =20 *************** RESET ROLE *** 63,78 **** Notes =20 ! Using this command, it is possible to either add privileges or restr= ict ! one's privileges. If the session user role has the INHERIT= S ! attribute, then it automatically has all the privileges of every rol= e that ! it could SET ROLE to; in this case SET R= OLE ! effectively drops all the privileges assigned directly to the sessio= n user ! and to the other roles it is a member of, leaving only the privilege= s ! available to the named role. On the other hand, if the session user= role ! has the NOINHERITS attribute, SET ROLE drops the ! privileges assigned directly to the session user and instead acquire= s the ! privileges available to the named role. =20 --- 63,94 ---- Notes =20 ! Role "X" is a MEMBER of role "Y" if there is a ch= ain of ! grants between them. Additionally, role "X" has USAGE ! of "Y", if "X", and all intermediate roles (but not necessarily "Y" = itself), ! are marked with the INHERIT attribute (which is t= he default). ! See the pg_has_role() ! for more information. ! !=20 ! ! Every role automatically has all the privileges it has been granted = directly, ! as well as that of every role with which it has USAGE. ! However role attributes (as defined by CREATE ROLE or ! ALTER ROLE) are not directly acquired from other = roles. ! Role attributes may only be gained via the SET ROLE command. ! !=20 ! ! The SET ROLE command drops all privileges assigne= d directly ! to the session user and instead acquires the privileges available to= the target ! role, including any roles for which the target has USAGE. ! The net effect is that the SET ROLE command may e= ither add ! privileges or restrict privileges. When the session role has ! USAGE on the target role, the remaining privilege= s will be ! equal to, or a subset of, the original privileges. On the other hand= , ! when the session role does not have USAGE on the = target ! role, the privileges may be completely different, and possibly expan= ded. =20 --------------011905E1D0D138C7CC38DD06-- --DzENM2QL7tST31SbNPKJRRacWhLRa9Gag-- --qvRV9VQW6ozUELoQFzuo9e7dwOFsUrsza Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEg14x9eymXoJyHrH+N/L3QzX32GUFAl1DM/4ACgkQN/L3QzX3 2GUWzQ//acXs5OFNvxTkN7BCI7s1M3roxEYnbHxo2ceK9aOPSX7bC3xpk/y2Hake sBEsBisXknuW/nep2NJV+aP5YCzc5nE7/mLj91xzXBDBooj4QYEUS3NCCDZXyo4k ZcDKnS1dBeFByswZRgwpMUtLpYPqtPrQKBGSvL2ubqpSGBFG3n+Lwkqs1sXMxi4s jBFpDB8W1iTrcif3E4hJeVqwmo2EZSaCWOnT1m3dmjrJjnsU9pYCiHBFTLwxOfpy auzoRq39D/YOdkmeT3ZYr7byYZ9IKXsfOESqoey+jfBLmn3RQbW67+ORxqirhV9Z l7Yp1dzJEDUI6EawJ6cvJr437FKSyxTRdkXrS4t08U4y1SdU43SoIa31R0bUiQMi fH5wmMNmXowaWgXp+7UkwXR+1zgw4amoMG9ywIAxQtsP3lq8tK7O/caWC7WwjdG5 Nwmk2KVkBK4641tfKYS6gYoReb1Wo1rwjyPotmiPFc0fJvy3oLSWMQdr+GbVTCrk WvgiVeo004nNE2wsAyJXnrQGmQ+d2/Qw+uUZbUyYVBFPmQfrBITGf+LsnDeCI0oC JEZSj0cZ4eB9+2A/m6rs2F09R1SxaiSYgpYGJgCC3cRVzmt6G4ZA3VCC3D8KXBXO R02NLnLEj4YAr5zu08/Zzjgm6rvHyn+U48d2HrrolNzL47xEby4= =yQyP -----END PGP SIGNATURE----- --qvRV9VQW6ozUELoQFzuo9e7dwOFsUrsza--