OSDN Git Service

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)
commitf23bdda3240d3aa511c843a4f91870d17b53b970
treedde3dcced0604a669eb4a91a6d9c8af100be10fc
parentd4a363cdf2b426bbf6c401543b8286ad86ca9bd5
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