Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 6265D1337B8D for ; Thu, 18 Nov 2010 14:35:31 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 54766-03 for ; Thu, 18 Nov 2010 18:35:24 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from spinlock.commandprompt.com (host-215.commandprompt.net [207.173.203.215]) by mail.postgresql.org (Postfix) with ESMTP id 234721335B36 for ; Thu, 18 Nov 2010 14:35:23 -0400 (AST) Received: from localhost (localhost [127.0.0.1]) by spinlock.commandprompt.com (Postfix) with ESMTP id A4BAF348023; Thu, 18 Nov 2010 10:35:18 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at commandprompt.com Received: from spinlock.commandprompt.com ([127.0.0.1]) by localhost (spinlock.commandprompt.com.commandprompt.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Kwm325dtoQy8; Thu, 18 Nov 2010 10:35:16 -0800 (PST) Received: from perhan.alvh.no-ip.org (unknown [190.95.24.94]) by spinlock.commandprompt.com (Postfix) with ESMTPSA id 1C616348022; Thu, 18 Nov 2010 10:35:16 -0800 (PST) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 05D0A6E4BB; Thu, 18 Nov 2010 15:35:13 -0300 (CLST) Content-Type: text/plain; charset=UTF-8 Cc: Jon Nelson , pgsql-bugs Subject: Re: Problem with ALTER TABLE - occasional "tuple concurrently updated" From: Alvaro Herrera To: Robert Haas In-reply-to: <1290105030-sup-5154@alvh.no-ip.org> References: <1290105030-sup-5154@alvh.no-ip.org> Date: Thu, 18 Nov 2010 15:35:12 -0300 Message-Id: <1290105289-sup-6685@alvh.no-ip.org> User-Agent: Sup/git Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201011/133 X-Sequence-Number: 28713 Excerpts from Alvaro Herrera's message of jue nov 18 15:31:16 -0300 2010: > Excerpts from Robert Haas's message of jue nov 18 15:11:37 -0300 2010: > > > In the current master branch, it appears that "ALTER TABLE c INHERIT > > p" takes a ShareUpdateExclusiveLock on the child, which seems > > sufficient, and an AccessShareLock on the parent, which seems like it > > might not be; though I'm having a hard time figuring out exactly when > > it wouldn't be, especially since in 8.4 I'm fairly sure any ALTER > > TABLE command takes an AccessExclusiveLock. > > What if two of these run at the same time, and the parent doesn't > have children when they start? They would both try to set > relhassubclass, no? Yep, duplicated the issue that way. -- Álvaro Herrera The PostgreSQL Company - Command Prompt, Inc. PostgreSQL Replication, Consulting, Custom Development, 24x7 support