Re: BUG #17231: ERROR: tuple concurrently updated - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #17231: ERROR: tuple concurrently updated
Date
Msg-id 967138.1634322291@sss.pgh.pa.us
Whole thread Raw
In response to BUG #17231: ERROR: tuple concurrently updated  (PG Bug reporting form <noreply@postgresql.org>)
List pgsql-bugs
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



pgsql-bugs by date:

Previous
From: Andrey Lepikhov
Date:
Subject: Re: SET SESSION AUTHORIZATION command doesn't update status of backend
Next
From: PG Bug reporting form
Date:
Subject: BUG #17232: DISTINCT ON does not allow AS