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 1sQUMp-00A3p8-R0 for pgsql-hackers@arkaria.postgresql.org; Sun, 07 Jul 2024 16:03:59 +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 1sQUMn-00Dbvs-Aj for pgsql-hackers@arkaria.postgresql.org; Sun, 07 Jul 2024 16:03:57 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sQUMn-00Dbvh-0l for pgsql-hackers@lists.postgresql.org; Sun, 07 Jul 2024 16:03:57 +0000 Received: from oss.nttdata.com ([49.212.34.109]) by magus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sQUMf-000u7v-9c for pgsql-hackers@lists.postgresql.org; Sun, 07 Jul 2024 16:03:55 +0000 Received: from [192.168.11.6] (p3619047-ipxg13201funabasi.chiba.ocn.ne.jp [61.207.96.47]) by oss.nttdata.com (Postfix) with ESMTPSA id DC5366187D for ; Mon, 8 Jul 2024 01:03:42 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at oss.nttdata.com Message-ID: <56596b81-088f-4c0c-9a88-b5f27a7a62e9@oss.nttdata.com> Date: Mon, 8 Jul 2024 01:03:42 +0900 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: PostgreSQL Developers Content-Language: en-US From: Fujii Masao Subject: pg_maintain and USAGE privilege on schema Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, I've noticed an issue with non-superusers who have the pg_maintain role. When they run VACUUM on a specific table within a specific schema, like "VACUUM mynsp.mytbl", it fails if they don't have the USAGE privilege on the schema. For example, the error message logged is "ERROR: permission denied for schema mynsp". However, running VACUUM without specifying the table name, such as "VACUUM", completes successfully and vacuums all tables, including those in schemas where the user lacks the USAGE privilege. Is this behavior intentional? This issue also affects other maintenance commands covered by pg_maintain. I assumed that a pg_maintain user could run VACUUM on specific tables in any schema without needing additional privileges. So, shouldn't pg_maintain users be able to perform maintenance commands as if they have USAGE rights on all schemas? If this has already been discussed and the current behavior is deemed proper, I'm sorry for bringing it up again. Even in that case, it would be helpful to document that USAGE privilege on the schema may be necessary in addition to pg_maintain to perform the maintenance command. Regards, -- Fujii Masao Advanced Computing Technology Center Research and Development Headquarters NTT DATA CORPORATION