pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: jmv@emorozov.net
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #17231: ERROR: tuple concurrently updated
Date: Fri, 15 Oct 2021 14:24:51 -0400
Message-ID: <967138.1634322291@sss.pgh.pa.us> (raw)
In-Reply-To: <17231-f6234f3f4a9c84dd@postgresql.org>
References: <17231-f6234f3f4a9c84dd@postgresql.org>

PG Bug reporting form <noreply@postgresql.org> 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





view thread (2+ messages)

Message-ID: <967138.1634322291@sss.pgh.pa.us>
Permalink:  ../967138.1634322291@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/967138.1634322291@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, jmv@emorozov.net, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #17231: ERROR: tuple concurrently updated
  In-Reply-To: <967138.1634322291@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox