Skip to content

Commit

Permalink
Merged if condition into one
Browse files Browse the repository at this point in the history
Task: BABEL-2170

Signed-off-by: Deepakshi Mittal <[email protected]>
  • Loading branch information
deepakshi-mittal committed Jan 2, 2024
1 parent f105495 commit 1aa495b
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions contrib/babelfishpg_tsql/src/hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -745,21 +745,15 @@ pltsql_bbfViewHasInsteadofTrigger(Relation view, CmdType event)
Oid current_tgoid = trigger->tgoid;
Oid prev_tgoid = InvalidOid;
prev_tgoid = lfirst_oid(list_tail(triggerInvocationSequence));
if (list_length(triggerInvocationSequence) > 32)
if (prev_tgoid == current_tgoid)
{
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("Maximum stored procedure, function, trigger, or view nesting level exceeded (limit 32)")));
}
else if (prev_tgoid == current_tgoid)
{
return false; /** A trigger called recursively by itself*/
return false; /** Loop trigger call by itself*/
}
else if (list_member_oid(triggerInvocationSequence, current_tgoid))
else if (list_length(triggerInvocationSequence) > 32 || list_member_oid(triggerInvocationSequence, current_tgoid))
{
/** A trigger called recursively by another trigger */
/** Loop trigger call by another trigger */
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
errmsg("Maximum stored procedure, function, trigger, or view nesting level exceeded (limit 32)")));
}
}
Expand Down

0 comments on commit 1aa495b

Please sign in to comment.