|
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/nodeFuncs.h"
|
32 | 33 | #include "optimizer/clauses.h"
|
@@ -315,6 +316,9 @@ static Node *
|
315 | 316 | pull_up_sublinks_jointree_recurse(PlannerInfo *root, Node *jtnode,
|
316 | 317 | Relids *relids)
|
317 | 318 | {
|
| 319 | + /* Since this function recurses, it could be driven to stack overflow. */ |
| 320 | + check_stack_depth(); |
| 321 | + |
318 | 322 | if (jtnode == NULL)
|
319 | 323 | {
|
320 | 324 | *relids = NULL;
|
@@ -812,6 +816,11 @@ pull_up_subqueries_recurse(PlannerInfo *root, Node *jtnode,
|
812 | 816 | JoinExpr *lowest_nulling_outer_join,
|
813 | 817 | AppendRelInfo *containing_appendrel)
|
814 | 818 | {
|
| 819 | + /* Since this function recurses, it could be driven to stack overflow. */ |
| 820 | + check_stack_depth(); |
| 821 | + /* Also, since it's a bit expensive, let's check for query cancel. */ |
| 822 | + CHECK_FOR_INTERRUPTS(); |
| 823 | + |
815 | 824 | Assert(jtnode != NULL);
|
816 | 825 | if (IsA(jtnode, RangeTblRef))
|
817 | 826 | {
|
@@ -1941,6 +1950,9 @@ is_simple_union_all(Query *subquery)
|
1941 | 1950 | static bool
|
1942 | 1951 | is_simple_union_all_recurse(Node *setOp, Query *setOpQuery, List *colTypes)
|
1943 | 1952 | {
|
| 1953 | + /* Since this function recurses, it could be driven to stack overflow. */ |
| 1954 | + check_stack_depth(); |
| 1955 | + |
1944 | 1956 | if (IsA(setOp, RangeTblRef))
|
1945 | 1957 | {
|
1946 | 1958 | RangeTblRef *rtr = (RangeTblRef *) setOp;
|
|
0 commit comments