pgsql: Fix LOCK TABLE to eliminate the race condition that could make it

From: tgl(at)postgresql(dot)org (Tom Lane)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix LOCK TABLE to eliminate the race condition that could make it
Date: 2009-05-12 16:43:32
Message-ID: 20090512164332.BFC1575407D@cvs.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Log Message:
-----------
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.

Modified Files:
--------------
pgsql/src/backend/access/heap:
heapam.c (r1.274 -> r1.275)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/access/heap/heapam.c?r1=1.274&r2=1.275)
pgsql/src/backend/commands:
lockcmds.c (r1.23 -> r1.24)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/lockcmds.c?r1=1.23&r2=1.24)
pgsql/src/include/access:
heapam.h (r1.141 -> r1.142)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/access/heapam.h?r1=1.141&r2=1.142)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message User Bmomjian 2009-05-12 20:07:57 pg-migrator - pg_migrator: Restructure handling of pg_dumpall output so
Previous Message User Bmomjian 2009-05-12 15:07:27 pg-migrator - pg_migrator: All only a single username for both clusters.

Browse pgsql-hackers by date

  From Date Subject
Next Message Alex Hunsaker 2009-05-12 18:10:08 Re: DROP TABLE vs inheritance
Previous Message decibel 2009-05-12 15:37:10 Re: display previous query string of idle-in-transaction