Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 2068C632FC9 for ; Tue, 12 May 2009 18:06:52 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 43520-01; Tue, 12 May 2009 18:06:44 -0300 (ADT) Received: from mx3.hub.org (mx3.hub.org [206.223.169.73]) by mail.postgresql.org (Postfix) with ESMTP id 77003634562; Tue, 12 May 2009 17:48:30 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from outmail128154.authsmtp.net (outmail128154.authsmtp.net [62.13.128.154]) by mx3.hub.org (Postfix) with ESMTP id E226037BC30; Tue, 12 May 2009 17:48:29 -0300 (ADT) Received: from mail-c188.authsmtp.com (mail-c188.authsmtp.com [62.13.128.25]) by punt3.authsmtp.com (8.14.2/8.14.2/Kp) with ESMTP id n4CKmO4V016711; Tue, 12 May 2009 21:48:24 +0100 (BST) Received: from [192.168.0.2] (85-211-96-202.dyn.gotadsl.co.uk [85.211.96.202]) (authenticated bits=0) by mail.authsmtp.com (8.14.2/8.14.2/Kp) with ESMTP id n4CKm7nI057315; Tue, 12 May 2009 21:48:19 +0100 (BST) Subject: Re: [COMMITTERS] pgsql: Fix LOCK TABLE to eliminate the race condition that could make it From: Simon Riggs To: Tom Lane Cc: pgsql-hackers@postgresql.org In-Reply-To: <20090512164332.BFC1575407D@cvs.postgresql.org> References: <20090512164332.BFC1575407D@cvs.postgresql.org> Content-Type: text/plain Date: Tue, 12 May 2009 21:50:38 +0100 Message-Id: <1242161438.3843.334.camel@ebony.2ndQuadrant> Mime-Version: 1.0 X-Mailer: Evolution 2.12.0 Content-Transfer-Encoding: 7bit X-Server-Quench: 3c602ac9-3f36-11de-aecc-001871e930f4 X-AuthRoute: OCdxZQATClZOTQEd DAteCiNZVAwpPBRK HVkIKg5MJUcNSQVJ NksadBtFaQdbYFhI HGQLW11EUlx7XWt/ aQ4fZQBDYEtPQQxs TkpJQE1QEQdtHhxP WBptKUR1KXxGfXlz ZEMsX3NYWQp5JkB9 QB8HHHAFM2RmdWEe BBVFJlYHIx5Kfh5N bVEqXXANN2FJBC9q VzwYGBUUHAljBR5u d0kVIkkLRRRDMD8s DzQlNhZnIWQvYwh7 MxtuJ1odGUcXO1k/ eUchVBoCOhQfaGxV GEdBATNYIF9JWyoi EUtRWlMaHHVYSCRR Shw0Sigg X-Authentic-SMTP: 61633235383639.cat.dmpriest.net.uk:1562/Kp X-Report-SPAM: If SPAM / abuse - report it at: http://www.authsmtp.com/abuse X-Virus-Status: No virus detected - but ensure you scan with your own anti-virus system. X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=AWL=0.050 X-Spam-Level: X-Archive-Number: 200905/544 X-Sequence-Number: 138086 On Tue, 2009-05-12 at 16:43 +0000, Tom Lane wrote: > 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. If we're going to require cascaded permissions like this, would it make sense to make GRANT cascade down the inheritance tree also? -- Simon Riggs www.2ndQuadrant.com PostgreSQL Training, Services and Support