|
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"
|
@@ -235,6 +236,9 @@ static Node *
|
235 | 236 | pull_up_sublinks_jointree_recurse(PlannerInfo *root, Node *jtnode,
|
236 | 237 | Relids *relids)
|
237 | 238 | {
|
| 239 | + /* Since this function recurses, it could be driven to stack overflow. */ |
| 240 | + check_stack_depth(); |
| 241 | + |
238 | 242 | if (jtnode == NULL)
|
239 | 243 | {
|
240 | 244 | *relids = NULL;
|
@@ -732,6 +736,11 @@ pull_up_subqueries_recurse(PlannerInfo *root, Node *jtnode,
|
732 | 736 | JoinExpr *lowest_nulling_outer_join,
|
733 | 737 | AppendRelInfo *containing_appendrel)
|
734 | 738 | {
|
| 739 | + /* Since this function recurses, it could be driven to stack overflow. */ |
| 740 | + check_stack_depth(); |
| 741 | + /* Also, since it's a bit expensive, let's check for query cancel. */ |
| 742 | + CHECK_FOR_INTERRUPTS(); |
| 743 | + |
735 | 744 | Assert(jtnode != NULL);
|
736 | 745 | if (IsA(jtnode, RangeTblRef))
|
737 | 746 | {
|
@@ -1854,6 +1863,9 @@ is_simple_union_all(Query *subquery)
|
1854 | 1863 | static bool
|
1855 | 1864 | is_simple_union_all_recurse(Node *setOp, Query *setOpQuery, List *colTypes)
|
1856 | 1865 | {
|
| 1866 | + /* Since this function recurses, it could be driven to stack overflow. */ |
| 1867 | + check_stack_depth(); |
| 1868 | + |
1857 | 1869 | if (IsA(setOp, RangeTblRef))
|
1858 | 1870 | {
|
1859 | 1871 | RangeTblRef *rtr = (RangeTblRef *) setOp;
|
|
0 commit comments