pgsql: pg_plan_advice: Add CHECK_FOR_INTERRUPTS() and check_stack_depth

From: Robert Haas <rhaas(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: pg_plan_advice: Add CHECK_FOR_INTERRUPTS() and check_stack_depth
Date: 2026-09-09 22:39:46
Message-ID: E1x4QxF-00000004Bl9-1axg@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

pg_plan_advice: Add CHECK_FOR_INTERRUPTS() and check_stack_depth()

Without CHECK_FOR_INTERRUPTS(), backends might not respond to query
cancellations in a timely fashion, especially for JOIN_ORDER()
specifications, where matching against each join can take O(n^2) time
in the length of the join order list in degenerate cases.

Recursive functions should check_stack_depth().

Reported-by: Noah Misch <noah(at)leadboat(dot)com>
Discussion: https://postgr.es/m/CA+TgmoYmXy-jiP5qDhqNEiYFEBzQsArO6O2d9E8szNZqi1bePQ@mail.gmail.com
Backpatch-through: 19

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/ddee5d03077c05925e83533e50ebe805c934d2cf

Modified Files
--------------
contrib/pg_plan_advice/pgpa_ast.c | 14 ++++++++++++++
contrib/pg_plan_advice/pgpa_planner.c | 7 +++++++
contrib/pg_plan_advice/pgpa_trove.c | 3 +++
3 files changed, 24 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2026-09-10 00:43:36 pgsql: Widen Object ID counter to 8 bytes
Previous Message Nathan Bossart 2026-09-09 21:30:50 pgsql: Add pg_nodiscard decorations to some Bitmapset functions.