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 1qb1oo-00AxbI-UG for pgsql-general@arkaria.postgresql.org; Tue, 29 Aug 2023 16:43:55 +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 1qb1on-0094Zg-LM for pgsql-general@arkaria.postgresql.org; Tue, 29 Aug 2023 16:43:53 +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 1qb1on-0094Yf-9m for pgsql-general@lists.postgresql.org; Tue, 29 Aug 2023 16:43:53 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qb1ok-001dES-2Y for pgsql-general@lists.postgresql.org; Tue, 29 Aug 2023 16:43:51 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 832165C00A2; Tue, 29 Aug 2023 12:43:47 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Tue, 29 Aug 2023 12:43:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mtneva.com; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm3; t= 1693327427; x=1693413827; bh=9j2eBnHxfAslfm9EU6xcT+1u7Xk7jKCkkwT ulyelAZc=; b=N5RD8JfQgOSVXUtak3t43QDGfHoZVQt5u9h4fh7aI0Ie4ow2vvF w9lHyRWK25aaz0bYNvcxvmVxE6CxUJWh3RpB7+YlSMLvi7YN+g2favt2yXe2Zba3 G8Ioa2Jn07lORZNLVz7N1j1z2/yPxXvwPIA9V4AW/qYxLg9MCXfd5keJFHSGU3lw UiGuaX97IHazAoDooiJdcigQvjTFyZH4nQmbL+IRMe7Ln97glEWa9qILConbK4Uy Ix+n2e5nb75pZnDAtYW9MHUXd8ND5P0s6e+yhcGHvpbO8VtFZnX9KeLRhZRgLmaF pliXRxjDAkV6ScBzNJnAHNQRMGQcXlL4ljQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1693327427; x=1693413827; bh=9j2eBnHxfAslfm9EU6xcT+1u7Xk7jKCkkwT ulyelAZc=; b=qRYoHlPJXxeyiH26ZB/io5p9mN6Snzo88btn8Ggmnc35F1+jGcm 4+VvnpJDHHuFsa0ToLd5w2zXHvRbVybXhBbc/9bqFe7lnctCY21dctk/ZdB5bWzL sPIX+1bqGGSRkd4w9b10rj8dbpRlprxWdT6JrHqSWGViKCqO/NLu47AbuzhCCo+7 6vjNyNemKYtKqCDlYw+i4hK/mUKnGryofYw3yhrGWCCiFxcgwHxapZErqDWINOFM ey+4hSK82FdkwOFvNEUQgHVrLPqITf0TJdVei9LvIMBsNt6+jy0UY6jYa1PeOq3A atPVwq21yKsrqsUvHTk/2vSPHZ09rIgjwLg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrudefiedguddthecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefkffggfgfhuffvvehfjggtgfesthekredttdefjeenucfhrhhomhepufht uhgrrhhtucfotgfirhgrficuoehsmhgtghegudeludesmhhtnhgvvhgrrdgtohhmqeenuc ggtffrrghtthgvrhhnpefgjeduudefteefheetkefhledvtedvkefgveeutdffudevvdfg ueffveegieejgfenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfh hrohhmpehsmhgtghegudeludesmhhtnhgvvhgrrdgtohhm X-ME-Proxy: Feedback-ID: i4271461c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 29 Aug 2023 12:43:46 -0400 (EDT) Received: from [10.1.65.222] (fuji.home [10.1.65.222]) by fuji.home (Postfix) with ESMTP id 9F8363A1759; Tue, 29 Aug 2023 10:43:45 -0600 (MDT) Message-ID: Date: Tue, 29 Aug 2023 10:43:45 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 From: Stuart McGraw Subject: Re: Restoring default privileges on objects To: pgsql-general@lists.postgresql.org Cc: Tom Lane , Erik Wienhold References: <96d6885a-5e25-9ae8-4a1a-d7e557a5fe9c@mtneva.com> <1166048641.281962.1693308151542@office.mailbox.org> <1006397.1693318485@sss.pgh.pa.us> Content-Language: en-US In-Reply-To: <1006397.1693318485@sss.pgh.pa.us> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 8/29/23 08:14, Tom Lane wrote: > Erik Wienhold writes: >> On 29/08/2023 03:23 CEST Stuart McGraw wrote: >>> If I've done a GRANT or REVOKE on some of the tables, how do I restore >>> the default privileges so that the “Access privileges” appears empty >>> again? I re-granted what I think are the default privileges but the >>> "Access privileges" column for that table contains "user1=arwdDxt/user1" >>> rather than being blank. This is Postgresql-14. > >> Yes, "user1=arwdDxt/user1" matches the default privileges if user1 is the table >> owner. > > Right. There is no (supported) way to cause the ACL entry to go back > to null. It starts life that way as an ancient hack to save a step > during object creation. But the moment you do anything to the object's > privileges, the NULL is replaced by an explicit representation of the > default privileges, which is then modified per whatever command you > are giving. After that the privileges will always be explicit. > > There's been occasional discussion of changing this behavior, but > it'd take work and it'd likely add about as much surprise as it > removes. People have been used to this quirk for a long time. Thank you Erik and Tom for the explanations. I guess it's a it-is- what-it-is situation :-). But while trying to figure it out myself I found the following: test=# CREATE ROLE user1; test=# SET ROLE user1; test=> CREATE TABLE t1(x int); test=> \dp Access privileges Schema | Name | Type | Access privileges | Column privileges | Policies --------+------+-------+-------------------+-------------------+---------- public | t1 | table | | | test=> SELECT FROM t1; (0 rows) test=> SET ROLE postgres; test=# REVOKE ALL ON t1 FROM user1; test=# SET ROLE user1; test=> \dp Schema | Name | Type | Access privileges | Column privileges | Policies --------+------+-------+-------------------+-------------------+---------- public | t1 | table | | | test=> SELECT FROM t1; ERROR: permission denied for table t1 How does one distinguish between (blank)=(default privileges) and (blank)=(no privileges)? Shouldn't psql put *something* (like "(default)" or "-") in the "Access privileges" column to indicate that? Or conversely, something (like "(none)"?) in the revoked case? It doesn't seem like a good idea to use the same visual representation for two nearly opposite conditions. It confused the heck out of me anyway... :-)