The following bug has been logged online:
Bug reference: 5609
Logged by: Rob Brucks
Email address: rob.brucks@rackspace.com
PostgreSQL version: 8.3.7
Operating system: Ubuntu 8.04
Description: Exclusive Locks & Permission
Details:
If a user that does not have permission to alter a table issues an alter he
acquires an exclusive lock BEFORE permission is checked and an error is
issued.
This causes concurrency problems since the unprivileged user causes other
threads to wait while it attempts to acquire an exclusive lock, only to have
it ultimately fail.
The user's permissions need to be checked before requesting an exclusive
lock on the table for the alter.
To re-create:
psql -U postgres -d postgres
postgres=# CREATE ROLE nobody NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT
LOGIN;
postgres=# CREATE TABLE tab1 (a int);
postgres=# REVOKE ALL ON tab1