GRANT/REVOKE take NO lock on the target object?! - Mailing list pgsql-hackers

From Robert Haas
Subject GRANT/REVOKE take NO lock on the target object?!
Date
Msg-id CA+TgmoYcQNaLTtyd52mPE7z2SvpzC+3mX86HZJMXNwLPdqrcZA@mail.gmail.com
Whole thread Raw
List 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



pgsql-hackers by date:

Previous
From: Stephen Frost
Date:
Subject: Re: Review of Row Level Security
Next
From: Robert Haas
Date:
Subject: Re: Making view dump/restore safe at the column-alias level