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