Re: Is this the expected behaviour for DDL-query execution?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Thomas Johansson <thomas(dot)johansson(at)agama(dot)tv>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Is this the expected behaviour for DDL-query execution?
Date: 2009-05-11 16:14:46
Message-ID: 2684.1242058486@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Thomas Johansson <thomas(dot)johansson(at)agama(dot)tv> writes:
> When performing an DROP TABLE query on a partition when one or more
> other threads are at the same time performing updates on the very same
> partitioned table (UPDATES which does not reference the partition key
> column!, i.e. all available partitions has to be checked for the row to
> be updated) which the partition are being dropped from I get the
> following errors:

> pg_log:
> 2009-05-10 00:00:41.451 CEST> ERROR: could not open relation with OID 24223

Yeah, this is possible because DROP TABLE does not attempt to acquire
exclusive lock on the victim table's parent(s). So if a concurrent
query operating on the parent had already obtained the victim table's
OID from pg_inherit, it would get this failure.

It's somewhat annoying but I'm not sure the cure wouldn't be worse than
the disease. In particular, a straight attempt to lock the parent would
result in deadlock failures in exactly the cases where you get this
error now.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2009-05-11 18:04:22 Re: BUG #4721: All sub-tables incorrectly included in search plan for partitioned table
Previous Message Thomas Johansson 2009-05-11 14:48:10 Is this the expected behaviour for DDL-query execution?