Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id C6D1B1337BB5 for ; Thu, 18 Nov 2010 14:31:41 -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 87480-06-2 for ; Thu, 18 Nov 2010 18:31:34 +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 6D0881337B8F for ; Thu, 18 Nov 2010 14:31:33 -0400 (AST) Received: from localhost (localhost [127.0.0.1]) by spinlock.commandprompt.com (Postfix) with ESMTP id 4CFC5348023; Thu, 18 Nov 2010 10:31:27 -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 VVAOmeh6JgDm; Thu, 18 Nov 2010 10:31:22 -0800 (PST) Received: from perhan.alvh.no-ip.org (unknown [190.95.24.94]) by spinlock.commandprompt.com (Postfix) with ESMTPSA id 7DFD8348022; Thu, 18 Nov 2010 10:31:21 -0800 (PST) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 7A3396E4BB; Thu, 18 Nov 2010 15:31:16 -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: References: Date: Thu, 18 Nov 2010 15:31:16 -0300 Message-Id: <1290105030-sup-5154@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/132 X-Sequence-Number: 28712 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? -- Álvaro Herrera The PostgreSQL Company - Command Prompt, Inc. PostgreSQL Replication, Consulting, Custom Development, 24x7 support