@ -36,6 +36,7 @@
# include "commands/tablespace.h"
# include "commands/tablespace.h"
# include "executor/spi.h"
# include "executor/spi.h"
# include "funcapi.h"
# include "funcapi.h"
# include "miscadmin.h"
# include "nodes/makefuncs.h"
# include "nodes/makefuncs.h"
# include "nodes/nodeFuncs.h"
# include "nodes/nodeFuncs.h"
# include "optimizer/clauses.h"
# include "optimizer/clauses.h"
@ -2608,6 +2609,10 @@ get_query_def(Query *query, StringInfo buf, List *parentnamespace,
deparse_context context ;
deparse_context context ;
deparse_namespace dpns ;
deparse_namespace dpns ;
/* Guard against excessively long or deeply-nested queries */
CHECK_FOR_INTERRUPTS ( ) ;
check_stack_depth ( ) ;
/*
/*
* Before we begin to examine the query , acquire locks on referenced
* Before we begin to examine the query , acquire locks on referenced
* relations , and fix up deleted columns in JOIN RTEs . This ensures
* relations , and fix up deleted columns in JOIN RTEs . This ensures
@ -3057,6 +3062,10 @@ get_setop_query(Node *setOp, Query *query, deparse_context *context,
StringInfo buf = context - > buf ;
StringInfo buf = context - > buf ;
bool need_paren ;
bool need_paren ;
/* Guard against excessively long or deeply-nested queries */
CHECK_FOR_INTERRUPTS ( ) ;
check_stack_depth ( ) ;
if ( IsA ( setOp , RangeTblRef ) )
if ( IsA ( setOp , RangeTblRef ) )
{
{
RangeTblRef * rtr = ( RangeTblRef * ) setOp ;
RangeTblRef * rtr = ( RangeTblRef * ) setOp ;
@ -4842,6 +4851,10 @@ get_rule_expr(Node *node, deparse_context *context,
if ( node = = NULL )
if ( node = = NULL )
return ;
return ;
/* Guard against excessively long or deeply-nested queries */
CHECK_FOR_INTERRUPTS ( ) ;
check_stack_depth ( ) ;
/*
/*
* Each level of get_rule_expr must emit an indivisible term
* Each level of get_rule_expr must emit an indivisible term
* ( parenthesized if necessary ) to ensure result is reparsed into the same
* ( parenthesized if necessary ) to ensure result is reparsed into the same