Re: Problem with ALTER TABLE - occasional "tuple concurrently updated"

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Jon Nelson <jnelson+pgsql(at)jamponi(dot)net>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Problem with ALTER TABLE - occasional "tuple concurrently updated"
Date: 2010-11-18 18:11:37
Message-ID: AANLkTimLfhgsZbUrqk1Rd+uJ9A5LAvUt11wAdUz-9fEQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu, Nov 18, 2010 at 10:28 AM, Jon Nelson <jnelson+pgsql(at)jamponi(dot)net> wrote:
> On Wed, Nov 17, 2010 at 8:57 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>> On Tue, Nov 16, 2010 at 10:48 AM, Jon Nelson <jnelson+pgsql(at)jamponi(dot)net> wrote:
>>> I have a process which runs in parallel creating tables which, as the
>>> /final/ step in the import, gets SQL much like the following applied:
>>>
>>> ALTER TABLE foo INHERIT bar;
>>>
>>> Periodically, I get this error:  tuple concurrently updated
>>
>> The ALTER TABLE generates that error?  Is it running concurrently with
>> any other DML?  What version of PostgreSQL is this?
>
> Yes, sometimes yes, and 8.4.5.

Any chance you can isolate a reproducible test case? Maybe a series
of steps to be run in two psql sessions? Or any idea what DDL might
be running against the parent at the same time?

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.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Alvaro Herrera 2010-11-18 18:31:16 Re: Problem with ALTER TABLE - occasional "tuple concurrently updated"
Previous Message Robert Haas 2010-11-18 17:59:31 Re: BUG #5744: Debugging doesn't work in version 8.3.12 on windows.