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 1peJXh-0004NG-0Q for pgsql-bugs@arkaria.postgresql.org; Mon, 20 Mar 2023 17:43:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1peJXf-0007Ih-Hp for pgsql-bugs@arkaria.postgresql.org; Mon, 20 Mar 2023 17:43:31 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1peJXf-0007IY-9l for pgsql-bugs@lists.postgresql.org; Mon, 20 Mar 2023 17:43:31 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1peJXc-0003Pk-UE for pgsql-bugs@lists.postgresql.org; Mon, 20 Mar 2023 17:43:30 +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 32KHhQBR954420; Mon, 20 Mar 2023 13:43:27 -0400 From: Tom Lane To: Jacob Champion cc: PostgreSQL Bugs Subject: Re: pg_dump needs SELECT privileges on irrelevant extension table In-reply-to: <00d46a48-3324-d9a0-49bf-e7f0f11d1038@timescale.com> References: <00d46a48-3324-d9a0-49bf-e7f0f11d1038@timescale.com> Comments: In-reply-to Jacob Champion message dated "Mon, 20 Mar 2023 09:44:24 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <954418.1679334206.1@sss.pgh.pa.us> Date: Mon, 20 Mar 2023 13:43:26 -0400 Message-ID: <954419.1679334206@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Jacob Champion writes: > We have a situation where we need to revoke SELECT on a table that > belongs to our extension, and we also need to let less privileged users > dump the extension's external config tables. In general, we don't expect that random minimum-privilege users can do a database-wide pg_dump, so I'm not entirely sure that I buy that this is a case we should cater to. Why shouldn't your dump user have enough privilege to take this lock? I'd be more willing to consider the proposed patch if it weren't such a hack --- as you say, it doesn't fix the problem when the table has policies, so it's hardly a general-purpose solution. I fear that it's also fairly expensive: adding sub-selects to the query we must do before we can lock any tables is not appetizing, because making that window wider adds to the risk of deadlocks, dump failures, etc. regards, tom lane