BUG #7594: "tuple concurrently updated" error on concurrent GRANT ON DATABASE statements - Mailing list pgsql-bugs

From max@suse.de
Subject BUG #7594: "tuple concurrently updated" error on concurrent GRANT ON DATABASE statements
Date
Msg-id E1TLyjV-0008JC-OV@wrigleys.postgresql.org
Whole thread Raw
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      7594
Logged by:          Reinhard Max
Email address:      max@suse.de
PostgreSQL version: 9.1.6
Operating system:   openSUSE
Description:        =


Is it intentional, that concurrent GRANT statements for the same database
may result in a "tuple concurrently updated" error?

It can be reproduced by running the following loop from two shells at the
same time:

while true; do psql -c "GRANT ALL ON DATABASE foo TO foo" ; done

I found that wrapping the GRANT statement in a transaction and explicitly
locking pg_table in SHARE UPDATE EXCLUSIVE mode makes the error disappear.
According to the documentation of the lock modes, statements like VACUUM
acquire this lock by itself, so I wonder if GRANT ON DATABASE should do the
same.

pgsql-bugs by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: BUG #7534: walreceiver takes long time to detect n/w breakdown
Next
From: demurcia@ockham-solutions.fr
Date:
Subject: BUG #7593: Unexpected query result combining or and in operators