BUG #7594: "tuple concurrently updated" error on concurrent GRANT ON DATABASE statements

From: max(at)suse(dot)de
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #7594: "tuple concurrently updated" error on concurrent GRANT ON DATABASE statements
Date: 2012-10-10 16:02:05
Message-ID: E1TLyjV-0008JC-OV@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 7594
Logged by: Reinhard Max
Email address: max(at)suse(dot)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.

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2012-10-10 17:17:32 Re: BUG #7593: Unexpected query result combining or and in operators
Previous Message demurcia 2012-10-10 15:54:26 BUG #7593: Unexpected query result combining or and in operators