Fix LOCK TABLE to eliminate the race condition that could make it give weird
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 12 May 2009 16:43:32 +0000 (16:43 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 12 May 2009 16:43:32 +0000 (16:43 +0000)
commitb970fc7e493422bd951f71ff96b815effdad9cc1
treef1f30154fdb6d8ba51fcdd79342f58f9447b95ca
parent10ec771ae7d437e6cee38ea71637f623bff2baf5
Fix LOCK TABLE to eliminate the race condition that could make it give weird
errors when tables are concurrently dropped.  To do this we must take lock
on each relation before we check its privileges.  The old code was trying
to do that the other way around, which is a bit pointless when there are lots
of other commands that lock relations before checking privileges.  I did keep
it checking each relation's privilege before locking the next relation, which
is a detail that ALTER TABLE isn't too picky about.
src/backend/access/heap/heapam.c
src/backend/commands/lockcmds.c
src/include/access/heapam.h