From fd77b3559fb912d79e671c91cd71153d808ff0ef Mon Sep 17 00:00:00 2001
From: Junwang Zhao <zhjwpku@gmail.com>
Date: Thu, 14 May 2026 22:18:29 +0800
Subject: [PATCH v3 1/4] Add interrupt checks during graph path query
 generation.

Put a CHECK_FOR_INTERRUPTS() alongside stack depth checks in
recursive path expansion so query cancellation remains responsive
for complex GRAPH_TABLE patterns.
---
 src/backend/rewrite/rewriteGraphTable.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/backend/rewrite/rewriteGraphTable.c b/src/backend/rewrite/rewriteGraphTable.c
index 33d4e866d74..2a87eeb6d79 100644
--- a/src/backend/rewrite/rewriteGraphTable.c
+++ b/src/backend/rewrite/rewriteGraphTable.c
@@ -364,6 +364,7 @@ generate_queries_for_path_pattern_recurse(RangeTblEntry *rte, List *pathqueries,
 
 	/* Guard against stack overflow due to complex path patterns. */
 	check_stack_depth();
+	CHECK_FOR_INTERRUPTS();
 
 	foreach_ptr(struct path_element, pe, path_elems)
 	{
-- 
2.41.0

