From 30ed631b20e13e82fe06cdc5947d5f2acfdc6d6d Mon Sep 17 00:00:00 2001 From: David Rowley Date: Fri, 18 Sep 2026 15:52:36 +1200 Subject: [PATCH] Add CHECK_FOR_INTERRUPTS when building pruning steps Building the partition pruning steps for excessively complex queries can take some time. Add CHECK_FOR_INTERRUPTS() to get_steps_using_prefix_recurse() to allow more timely processing of interruptions. Bug: #19692 Reported-by: Qifan Liu Discussion: https://postgr.es/m/19692-dacfc57cda5035fc@postgresql.org Backpatch-through: 14 --- src/backend/partitioning/partprune.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/backend/partitioning/partprune.c b/src/backend/partitioning/partprune.c index c3e9775539f..cbc9d7cc8ff 100644 --- a/src/backend/partitioning/partprune.c +++ b/src/backend/partitioning/partprune.c @@ -2502,6 +2502,8 @@ get_steps_using_prefix_recurse(GeneratePruningStepsContext *context, /* Actually, recursion would be limited by PARTITION_MAX_KEYS. */ check_stack_depth(); + CHECK_FOR_INTERRUPTS(); + Assert(start != NULL); cur_keyno = ((PartClauseInfo *) lfirst(start))->keyno; final_keyno = ((PartClauseInfo *) llast(prefix))->keyno;