|
26 | 26 | #include "postgres.h"
|
27 | 27 |
|
28 | 28 | #include "catalog/pg_type.h"
|
| 29 | +#include "miscadmin.h" |
29 | 30 | #include "nodes/makefuncs.h"
|
30 | 31 | #include "nodes/nodeFuncs.h"
|
31 | 32 | #include "optimizer/clauses.h"
|
@@ -230,6 +231,9 @@ static Node *
|
230 | 231 | pull_up_sublinks_jointree_recurse(PlannerInfo *root, Node *jtnode,
|
231 | 232 | Relids *relids)
|
232 | 233 | {
|
| 234 | + /* Since this function recurses, it could be driven to stack overflow. */ |
| 235 | + check_stack_depth(); |
| 236 | + |
233 | 237 | if (jtnode == NULL)
|
234 | 238 | {
|
235 | 239 | *relids = NULL;
|
@@ -715,6 +719,11 @@ pull_up_subqueries_recurse(PlannerInfo *root, Node *jtnode,
|
715 | 719 | JoinExpr *lowest_nulling_outer_join,
|
716 | 720 | AppendRelInfo *containing_appendrel)
|
717 | 721 | {
|
| 722 | + /* Since this function recurses, it could be driven to stack overflow. */ |
| 723 | + check_stack_depth(); |
| 724 | + /* Also, since it's a bit expensive, let's check for query cancel. */ |
| 725 | + CHECK_FOR_INTERRUPTS(); |
| 726 | + |
718 | 727 | Assert(jtnode != NULL);
|
719 | 728 | if (IsA(jtnode, RangeTblRef))
|
720 | 729 | {
|
@@ -1761,6 +1770,9 @@ is_simple_union_all(Query *subquery)
|
1761 | 1770 | static bool
|
1762 | 1771 | is_simple_union_all_recurse(Node *setOp, Query *setOpQuery, List *colTypes)
|
1763 | 1772 | {
|
| 1773 | + /* Since this function recurses, it could be driven to stack overflow. */ |
| 1774 | + check_stack_depth(); |
| 1775 | + |
1764 | 1776 | if (IsA(setOp, RangeTblRef))
|
1765 | 1777 | {
|
1766 | 1778 | RangeTblRef *rtr = (RangeTblRef *) setOp;
|
|
0 commit comments