Re: BUG #17231: ERROR: tuple concurrently updated

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: jmv(at)emorozov(dot)net
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #17231: ERROR: tuple concurrently updated
Date: 2021-10-15 18:24:51
Message-ID: 967138.1634322291@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

PG Bug reporting form <noreply(at)postgresql(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2021-10-15 22:41:35 BUG #17232: DISTINCT ON does not allow AS
Previous Message Andrey Lepikhov 2021-10-15 17:44:41 Re: SET SESSION AUTHORIZATION command doesn't update status of backend