Re: FailedAssertion("pd_idx == pinfo->nparts", File: "execPartition.c", Line: 1689)
Robert Haas <robertmhaas@gmail.com>
From: Robert Haas <robertmhaas@gmail.com>
To: Justin Pryzby <pryzby@telsasoft.com>
Cc: "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2020-08-03T15:41:37Z
Lists: pgsql-hackers
On Sun, Aug 2, 2020 at 2:11 PM Justin Pryzby <pryzby@telsasoft.com> wrote: > Based on commit logs, I suspect this may be an "older bug", specifically maybe > with: > > |commit 898e5e3290a72d288923260143930fb32036c00c > |Author: Robert Haas <rhaas@postgresql.org> > |Date: Thu Mar 7 11:13:12 2019 -0500 > | > | Allow ATTACH PARTITION with only ShareUpdateExclusiveLock. > > I don't think it matters, but the process surrounding the table being INSERTed > INTO is more than a little special, involving renames, detaches, creation, > re-attaching within a transaction. I think that doesn't matter though, and the > issue is surrounding the table being SELECTed *from*, which is actually behind > a view. That's an entirely reasonable guess, but it doesn't seem easy to understand exactly what happened here based on the provided information. The assertion failure probably indicates that pinfo->relid_map[] and partdesc->oids[] differ in some way other than additional elements having been inserted into the latter. For example, some elements might have disappeared, or the order might have changed. This isn't supposed to happen, because DETACH PARTITION requires heavier locking, and the order changing without anything getting detached should be impossible. But evidently it did. If we could dump out the two arrays in question it might shed more light on exactly how things went wrong. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
Commits
-
Support testing of cases where table schemas change after planning.
- 6f0b632f083b 14.0 landed
-
Fix matching of sub-partitions when a partitioned plan is stale.
- f992da210ff8 12.4 landed
- c43a36fa8fff 13.0 landed
- 7a980dfc6c15 14.0 landed
-
Speed up planning when partitions can be pruned at plan time.
- 428b260f87e8 12.0 cited
-
Allow ATTACH PARTITION with only ShareUpdateExclusiveLock.
- 898e5e3290a7 12.0 cited