GRANT/REVOKE take NO lock on the target object?!

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: GRANT/REVOKE take NO lock on the target object?!
Date: 2012-12-22 01:43:18
Message-ID: CA+TgmoYcQNaLTtyd52mPE7z2SvpzC+3mX86HZJMXNwLPdqrcZA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

S1:

rhaas=# create table foo (a int);
CREATE TABLE
rhaas=# begin;
BEGIN
rhaas=# lock foo;
LOCK TABLE

S2:

rhaas=# grant all on foo to public;
GRANT
rhaas=# revoke all on foo from public;
REVOKE

This seems quite obviously silly, given the amount of time and energy
we've spent worrying about ALTER TABLE lock levels. Note that
GRANT/REVOKE on a table do a not-in-place update of the pg_class row;
with anything less than an AccessExclusiveLock, the usual SnapshotNow
hazards exist: another session can fail to find the pg_class row
altogether.

[ Credit: Noah Misch helped me trace down the problem that led me to
this report. ]

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2012-12-22 01:48:59 Re: Making view dump/restore safe at the column-alias level
Previous Message Stephen Frost 2012-12-22 01:03:53 Re: Review of Row Level Security