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 1mbRt7-0007yH-GN for pgsql-bugs@arkaria.postgresql.org; Fri, 15 Oct 2021 18:25:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mbRt6-0004wb-EY for pgsql-bugs@arkaria.postgresql.org; Fri, 15 Oct 2021 18:25:00 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mbRt6-0004wR-7X for pgsql-bugs@lists.postgresql.org; Fri, 15 Oct 2021 18:25:00 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mbRt3-0000Fx-Gt for pgsql-bugs@lists.postgresql.org; Fri, 15 Oct 2021 18:24:58 +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 19FIOp5k967139; Fri, 15 Oct 2021 14:24:51 -0400 From: Tom Lane To: jmv@emorozov.net cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #17231: ERROR: tuple concurrently updated In-reply-to: <17231-f6234f3f4a9c84dd@postgresql.org> References: <17231-f6234f3f4a9c84dd@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Fri, 15 Oct 2021 17:38:36 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <967137.1634322291.1@sss.pgh.pa.us> Date: Fri, 15 Oct 2021 14:24:51 -0400 Message-ID: <967138.1634322291@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk PG Bug reporting form writes: > [ this: ] > c.execute('REFRESH MATERIALIZED VIEW CONCURRENTLY ab') > [ concurrently with this: ] > c.execute('GRANT ALL ON ALL TABLES IN SCHEMA public TO web_admin') > [ results in "tuple concurrently updated" ] Yeah, that's not very surprising, because both commands need to update ab's pg_class row. We could only really prevent this by having GRANT take an exclusive lock on the object(s) it's altering the ACLs of. That cure would likely be worse than the disease, especially for variants like GRANT ON ALL TABLES, which'd need to ex-lock quite a lot of objects, probably causing deadlock failures. So I'm not sure that there's any good way to improve this. (There are, BTW, probably plenty of ways to cause this type of failure when you do concurrent DDL commands on a single object.) regards, tom lane