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 1tl8T5-009ZcY-6n for pgsql-general@arkaria.postgresql.org; Thu, 20 Feb 2025 15:28:03 +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 1tl8T2-008GE1-HS for pgsql-general@arkaria.postgresql.org; Thu, 20 Feb 2025 15:28:00 +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 1tl8T2-008GDt-6j for pgsql-general@lists.postgresql.org; Thu, 20 Feb 2025 15:28:00 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tl8Sz-001yxJ-1n for pgsql-general@lists.postgresql.org; Thu, 20 Feb 2025 15:27:59 +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 51KFRrJH2701261; Thu, 20 Feb 2025 10:27:53 -0500 From: Tom Lane To: Dominique Devienne cc: pgsql-general@lists.postgresql.org Subject: Re: #XX000: ERROR: tuple concurrently updated In-reply-to: References: Comments: In-reply-to Dominique Devienne message dated "Thu, 20 Feb 2025 15:31:35 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2701259.1740065273.1@sss.pgh.pa.us> Date: Thu, 20 Feb 2025 10:27:53 -0500 Message-ID: <2701260.1740065273@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Dominique Devienne writes: > Hi. A tester just tried to restore two custom backups (not official > PostgreSQL ones) concurrently. > ... > The second session completed OK. > But the first session errors out with: > Error: DDL Error: GRANT USAGE ON SCHEMA "SCH1", "SCH2" TO "SCH2:RO", > "SCH2:RW", "SCH2:SU": #XX000: ERROR: tuple concurrently updated > Thus I'm trying to understand what's going on. Since both restores tried to grant some permissions on SCH1, they both had to update SCH1's pg_namespace row (specifically nspacl). We have no support for concurrent updates in the catalog-manipulation code, so if the second run arrives at that step before the first one has committed its pg_namespace change, you get this error. > Is the issue related to trying to change SCHEMA ACLs for SCH1 concurrently, > in two long running transactions? How am I supposed to resolve this? The window is probably too small to hit if each restore is committing as it goes, but if you run in --single-transaction mode then this isn't surprising. I'd say don't try to run concurrent restores. regards, tom lane