|
27 | 27 |
|
28 | 28 | #include "catalog/pg_type.h"
|
29 | 29 | #include "funcapi.h"
|
| 30 | +#include "miscadmin.h" |
30 | 31 | #include "nodes/makefuncs.h"
|
31 | 32 | #include "nodes/multibitmapset.h"
|
32 | 33 | #include "nodes/nodeFuncs.h"
|
@@ -308,6 +309,9 @@ static Node *
|
308 | 309 | pull_up_sublinks_jointree_recurse(PlannerInfo *root, Node *jtnode,
|
309 | 310 | Relids *relids)
|
310 | 311 | {
|
| 312 | + /* Since this function recurses, it could be driven to stack overflow. */ |
| 313 | + check_stack_depth(); |
| 314 | + |
311 | 315 | if (jtnode == NULL)
|
312 | 316 | {
|
313 | 317 | *relids = NULL;
|
@@ -805,6 +809,11 @@ pull_up_subqueries_recurse(PlannerInfo *root, Node *jtnode,
|
805 | 809 | JoinExpr *lowest_nulling_outer_join,
|
806 | 810 | AppendRelInfo *containing_appendrel)
|
807 | 811 | {
|
| 812 | + /* Since this function recurses, it could be driven to stack overflow. */ |
| 813 | + check_stack_depth(); |
| 814 | + /* Also, since it's a bit expensive, let's check for query cancel. */ |
| 815 | + CHECK_FOR_INTERRUPTS(); |
| 816 | + |
808 | 817 | Assert(jtnode != NULL);
|
809 | 818 | if (IsA(jtnode, RangeTblRef))
|
810 | 819 | {
|
@@ -1937,6 +1946,9 @@ is_simple_union_all(Query *subquery)
|
1937 | 1946 | static bool
|
1938 | 1947 | is_simple_union_all_recurse(Node *setOp, Query *setOpQuery, List *colTypes)
|
1939 | 1948 | {
|
| 1949 | + /* Since this function recurses, it could be driven to stack overflow. */ |
| 1950 | + check_stack_depth(); |
| 1951 | + |
1940 | 1952 | if (IsA(setOp, RangeTblRef))
|
1941 | 1953 | {
|
1942 | 1954 | RangeTblRef *rtr = (RangeTblRef *) setOp;
|
|
0 commit comments