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 1s1eoj-00DrPD-SD for pgsql-hackers@arkaria.postgresql.org; Tue, 30 Apr 2024 04:10:09 +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 1s1eoh-003riq-4F for pgsql-hackers@arkaria.postgresql.org; Tue, 30 Apr 2024 04:10:08 +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 1s1eog-003rii-R4 for pgsql-hackers@lists.postgresql.org; Tue, 30 Apr 2024 04:10:07 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s1eof-000iFF-BB for pgsql-hackers@lists.postgresql.org; Tue, 30 Apr 2024 04:10:06 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 43U4A2M11562012; Tue, 30 Apr 2024 00:10:02 -0400 From: Tom Lane To: "David G. Johnston" cc: Daniel Gustafsson , PostgreSQL Hackers , Stephen Frost , Andres Freund Subject: Re: DROP OWNED BY fails to clean out pg_init_privs grants In-reply-to: References: <1745535.1712358659@sss.pgh.pa.us> <78CCD91B-99DC-4B0F-B65E-AD46E67CBC0B@yesql.se> <2857513.1713733688@sss.pgh.pa.us> <32556.1714165429@sss.pgh.pa.us> <378162.1714257933@sss.pgh.pa.us> <772627.1714330360@sss.pgh.pa.us> <33E80863-5516-45A1-93D1-00F1A166EC7C@yesql.se> <1372432.1714418108@sss.pgh.pa.us> Comments: In-reply-to "David G. Johnston" message dated "Mon, 29 Apr 2024 21:00:20 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1562010.1714450202.1@sss.pgh.pa.us> Date: Tue, 30 Apr 2024 00:10:02 -0400 Message-ID: <1562011.1714450202@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk "David G. Johnston" writes: > My solution to this was to rely on the fact that the bootstrap superuser is > assigned OID 10 regardless of its name. Yeah, I wrote it that way to start with too, but reconsidered because (1) I don't like hard-coding numeric OIDs. We can avoid that in C code but it's harder to do in SQL. (2) It's not clear to me that this test couldn't be run by a non-bootstrap superuser. I think "current_user" is actually the correct thing for the role executing the test. regards, tom lane