v3-0001-other_subplans-bug-delta.patch

text/plain

Filename: v3-0001-other_subplans-bug-delta.patch
Type: text/plain
Part: 1
Message: Re: Internal error XX000 with enable_partition_pruning=on, pg 11 beta1 on Debian

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: unified
Series: patch v3-0001
File+
src/backend/executor/execPartition.c 13 0
diff --git a/src/backend/executor/execPartition.c b/src/backend/executor/execPartition.c
index dac789d414..b5f796f5ed 100644
--- a/src/backend/executor/execPartition.c
+++ b/src/backend/executor/execPartition.c
@@ -1669,6 +1669,19 @@ ExecFindInitialMatchingSubPlans(PartitionPruneState *prunestate, int nsubplans)
 				new_subplan_indexes[i] = newidx++;
 			else
 				new_subplan_indexes[i] = -1;	/* Newly pruned */
+
+			/*
+			 * If a subplan in other_subplans got its index updated, update
+			 * other_subplans too.
+			 */
+			if (bms_is_member(i, prunestate->other_subplans))
+			{
+				prunestate->other_subplans =
+							bms_del_member(prunestate->other_subplans, i);
+				prunestate->other_subplans =
+							bms_add_member(prunestate->other_subplans,
+										   new_subplan_indexes[i]);
+			}
 		}
 
 		/*