@ -7630,6 +7630,9 @@ set_attnotnull(List **wqueue, Relation rel, AttrNumber attnum, bool recurse,
Form_pg_attribute attForm ;
Form_pg_attribute attForm ;
bool retval = false ;
bool retval = false ;
/* Guard against stack overflow due to overly deep inheritance tree. */
check_stack_depth ( ) ;
tuple = SearchSysCacheCopyAttNum ( RelationGetRelid ( rel ) , attnum ) ;
tuple = SearchSysCacheCopyAttNum ( RelationGetRelid ( rel ) , attnum ) ;
if ( ! HeapTupleIsValid ( tuple ) )
if ( ! HeapTupleIsValid ( tuple ) )
elog ( ERROR , " cache lookup failed for attribute %d of relation %u " ,
elog ( ERROR , " cache lookup failed for attribute %d of relation %u " ,
@ -7716,6 +7719,9 @@ ATExecSetNotNull(List **wqueue, Relation rel, char *conName, char *colName,
bool is_no_inherit = false ;
bool is_no_inherit = false ;
List * ready = NIL ;
List * ready = NIL ;
/* Guard against stack overflow due to overly deep inheritance tree. */
check_stack_depth ( ) ;
/*
/*
* In cases of multiple inheritance , we might visit the same child more
* In cases of multiple inheritance , we might visit the same child more
* than once . In the topmost call , set up a list that we fill with all
* than once . In the topmost call , set up a list that we fill with all
@ -9359,6 +9365,9 @@ ATAddCheckNNConstraint(List **wqueue, AlteredTableInfo *tab, Relation rel,
ListCell * child ;
ListCell * child ;
ObjectAddress address = InvalidObjectAddress ;
ObjectAddress address = InvalidObjectAddress ;
/* Guard against stack overflow due to overly deep inheritance tree. */
check_stack_depth ( ) ;
/* At top level, permission check was done in ATPrepCmd, else do it */
/* At top level, permission check was done in ATPrepCmd, else do it */
if ( recursing )
if ( recursing )
ATSimplePermissions ( AT_AddConstraint , rel , ATT_TABLE | ATT_FOREIGN_TABLE ) ;
ATSimplePermissions ( AT_AddConstraint , rel , ATT_TABLE | ATT_FOREIGN_TABLE ) ;
@ -12428,6 +12437,9 @@ dropconstraint_internal(Relation rel, HeapTuple constraintTup, DropBehavior beha
return InvalidObjectAddress ;
return InvalidObjectAddress ;
* readyRels = lappend_oid ( * readyRels , RelationGetRelid ( rel ) ) ;
* readyRels = lappend_oid ( * readyRels , RelationGetRelid ( rel ) ) ;
/* Guard against stack overflow due to overly deep inheritance tree. */
check_stack_depth ( ) ;
/* At top level, permission check was done in ATPrepCmd, else do it */
/* At top level, permission check was done in ATPrepCmd, else do it */
if ( recursing )
if ( recursing )
ATSimplePermissions ( AT_DropConstraint , rel , ATT_TABLE | ATT_FOREIGN_TABLE ) ;
ATSimplePermissions ( AT_DropConstraint , rel , ATT_TABLE | ATT_FOREIGN_TABLE ) ;