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 1lHU58-0000eh-85 for pgsql-general@arkaria.postgresql.org; Wed, 03 Mar 2021 16:10:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lHU57-0001F0-5y for pgsql-general@arkaria.postgresql.org; Wed, 03 Mar 2021 16:10:37 +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 1lHU56-0001Es-U4 for pgsql-general@lists.postgresql.org; Wed, 03 Mar 2021 16:10:36 +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 1lHU54-0007pX-M1 for pgsql-general@lists.postgresql.org; Wed, 03 Mar 2021 16:10:36 +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 123GASGS1182967; Wed, 3 Mar 2021 11:10:28 -0500 From: Tom Lane To: Tobias Lott cc: Laurenz Albe , pgsql-general@lists.postgresql.org Subject: Re: permission denied for pg_temp_XX when vacuuming In-reply-to: References: <1180816.1614784546@sss.pgh.pa.us> Comments: In-reply-to Tobias Lott message dated "Wed, 03 Mar 2021 17:02:21 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1182965.1614787828.1@sss.pgh.pa.us> Date: Wed, 03 Mar 2021 11:10:28 -0500 Message-ID: <1182966.1614787828@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Tobias Lott writes: > Yes that's strange. A lot of pg_XX tables are skipped, but some of these > pg_temp schemas cause errors. > Could it be connected to a migration of the database (from an instance > running PostgreSQL 9.6 to an instance running PostgreSQL 12) done a few > weeks ago? I wouldn't have expected a migration to bring any temp tables forward. Have you had any crashes on this instance (post-migration)? A possible theory is that crashed backend(s) left behind some temp tables, and then if vacuumdb's backend process re-uses the backend ID (which determines the NN in pg_temp_NN) of one of those sessions, it would think those temp tables are its own and try to vacuum them. Or at least I think it might. That still fails to explain the permissions errors in any detail, but at least it offers a reason why vacuumdb would even be going anywhere near a temp table. regards, tom lane