Re: Is this the expected behaviour for DDL-query execution? - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Is this the expected behaviour for DDL-query execution?
Date
Msg-id 2684.1242058486@sss.pgh.pa.us
Whole thread Raw
In response to Is this the expected behaviour for DDL-query execution?  (Thomas Johansson <thomas.johansson@agama.tv>)
Responses Re: Is this the expected behaviour for DDL-query execution?
List pgsql-bugs
Thomas Johansson <thomas.johansson@agama.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

pgsql-bugs by date:

Previous
From: Thomas Johansson
Date:
Subject: Is this the expected behaviour for DDL-query execution?
Next
From: Tom Lane
Date:
Subject: Re: BUG #4721: All sub-tables incorrectly included in search plan for partitioned table