mirror of
https://github.com/postgres/postgres.git
synced 2025-07-21 16:02:15 +03:00
Avoid referencing off the end of subplan_partition_offsets.
Report by buildfarm member skink and Tom Lane. Analysis by me. Patch by Amit Khandekar. Discussion: http://postgr.es/m/CAJ3gD9fVA1iXQYhfqHP5n_TEd4U9=V8TL_cc-oKRnRmxgdvJrQ@mail.gmail.com
This commit is contained in:
@ -87,6 +87,7 @@ ExecSetupPartitionTupleRouting(ModifyTableState *mtstate,
|
||||
num_update_rri = list_length(node->plans);
|
||||
proute->subplan_partition_offsets =
|
||||
palloc(num_update_rri * sizeof(int));
|
||||
proute->num_subplan_partition_offsets = num_update_rri;
|
||||
|
||||
/*
|
||||
* We need an additional tuple slot for storing transient tuples that
|
||||
@ -481,6 +482,7 @@ ExecCleanupTupleRouting(PartitionTupleRouting *proute)
|
||||
* result rels are present in the UPDATE subplans.
|
||||
*/
|
||||
if (proute->subplan_partition_offsets &&
|
||||
subplan_index < proute->num_subplan_partition_offsets &&
|
||||
proute->subplan_partition_offsets[subplan_index] == i)
|
||||
{
|
||||
subplan_index++;
|
||||
|
Reference in New Issue
Block a user