Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k48E2-0002yV-7W for pgsql-general@arkaria.postgresql.org; Fri, 07 Aug 2020 19:40:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1k48E0-0007Jp-RH for pgsql-general@arkaria.postgresql.org; Fri, 07 Aug 2020 19:40:20 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k48Dz-0007Jh-8E for pgsql-general@lists.postgresql.org; Fri, 07 Aug 2020 19:40:20 +0000 Received: from wout4-smtp.messagingengine.com ([64.147.123.20]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k48Du-00087Z-La for pgsql-general@lists.postgresql.org; Fri, 07 Aug 2020 19:40:17 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id ED07E7DA; Fri, 7 Aug 2020 15:40:11 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Fri, 07 Aug 2020 15:40:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm3; bh=1 P+iEogbaoUfRpbPlR8cSIH4PDkytZuHclTvInom3gM=; b=TW9WKHjODLZ/ksKrD qjvV3rNYEuvqN2nJyLD9EzxTOvpZPakYimBgEGR7FurtcO9723JPMHQreI1d+J4A W6pOcgWuedZlHmhxkIoENAdSOcAinPUgjsXnAq8DVe3iE8+xuzDqaQJZ6yrcrzMm HACxtfWNq2cck3UPVOXv8CPFwqoBk5bU80oZx0zVQtppmPKRwdnowxZ3rpwDAp1V 62iHBUj4SFkywx7D58RsN5SjY2kNYzhNuFuPBgeeNr5P4bhmWVeC0SLjvPUxsoUQ qNwl5dUyylgBr6zTCBtlqbuAydsLjt53XMJR+PFqGFm5A4Zf55PTmqgbtnZV4BF+ bSOdw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=1P+iEogbaoUfRpbPlR8cSIH4PDkytZuHclTvInom3 gM=; b=grCreYg0d35HYCyx74jy29P5kUKaw9V7HJVSfydDqUQvxlTv5U7tdNZAo LyVw9vl5fVhqm3YC8Xp7LnwxVTbsT3OWEYIMP56ShYgC9o1mCM8B/tWQf2tFS3Sz B7Fa4/yzbS8pdB3zab/uiAtaTUI+fjRJjidFW7i7kWL2V1H25+BIht0+jGRje1Da yzEz4o0flvyFFkEx0rEaVLVq3AOitZEZgGiM+x3+3TyhhOh4z8R0lxjRN7TpUR+K s6Q6bSaAf5ERa7ifm/BEBh7kNuUfjUgarh1Uwtppm3KFD7NyoUiSapV4RmyaUID6 VQwrXAc9ImrdekfSC+0LAl23OUGBQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrkedvgddufeeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepuffvfhfhkffffgggjggtgfesthejredttdefjeenucfhrhhomheptegurhhi rghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtoh hmqeenucggtffrrghtthgvrhhnpeetjedvteffjeeuvdelieeffeehuedthffgvdfhhffh kedvudevgedvjedufefgveenucfkphepjeehrddujedvrdehrddvfedunecuvehluhhsth gvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprggurhhirghnrdhklhgr vhgvrhesrghklhgrvhgvrhdrtghomh X-ME-Proxy: Received: from [192.168.1.3] (75-172-5-231.tukw.qwest.net [75.172.5.231]) by mail.messagingengine.com (Postfix) with ESMTPA id 8B37F3280059; Fri, 7 Aug 2020 15:40:10 -0400 (EDT) Subject: Re: privileges oddity To: Scott Ribe Cc: Tom Lane , PostgreSQL General References: <20200806185329.GC29590@tamriel.snowman.net> <75f2f28c-9121-c3d0-0c9a-f9b16ef337fb@aklaver.com> <3DF00E97-6D2F-4329-AA0E-9CC2CCD41A8E@elevated-dev.com> <1ceb2a2f-50a0-ef7c-1849-6fa75dd61d64@aklaver.com> <5AA78DA8-746A-4407-AC00-B1463451CAD0@elevated-dev.com> <7efe4d40-5f8d-f3bb-45ff-fd00f3beba84@aklaver.com> <140C61E1-282D-42C2-8349-B5D11792DFCE@elevated-dev.com> <2793218.1596825900@sss.pgh.pa.us> <99994f76-5a45-09a1-c6e3-4021cb4bd385@aklaver.com> <997A0678-B203-432F-AF7D-7ADB6415C28A@elevated-dev.com> From: Adrian Klaver Message-ID: Date: Fri, 7 Aug 2020 12:40:09 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: <997A0678-B203-432F-AF7D-7ADB6415C28A@elevated-dev.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 8/7/20 12:27 PM, Scott Ribe wrote: >> On Aug 7, 2020, at 1:08 PM, Adrian Klaver wrote: >> >> "Using this command, it is possible to either add privileges or restrict one's privileges. If the session user role has the INHERIT attribute, then it automatically has all the privileges of every role that it could SET ROLE to; in this case SET ROLE effectively drops all the privileges assigned directly to the session user and to the other roles it is a member of, leaving only the privileges available to the named role. On the other hand, if the session user role has the NOINHERIT attribute, SET ROLE drops the privileges assigned directly to the session user and instead acquires the privileges available to the named role. >> " > > So it would only have removed privs if I had used set role in the session, which I am not. > See Tom's answer. To confirm do: SELECT s.setdatabase, s.setrole, rolname, s.setconfig, rolname FROM pg_db_role_setting AS s JOIN pg_roles AS r ON r.oid = s.setrole; -- Adrian Klaver adrian.klaver@aklaver.com