You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
Fix ENABLE/DISABLE TRIGGER to handle recursion correctly
Using ATSimpleRecursion() in ATPrepCmd() to do so asbbb927b did isnot correct, because ATPrepCmd() can't distinguish between triggers thatmay be cloned and those that may not, so would wrongly try to recursefor the latter category of triggers.So this commit restores the code in EnableDisableTrigger() that86f5759 had added to do the recursion, which would do it only fortriggers that may be cloned, that is, row-level triggers. This alsochanges tablecmds.c such that ATExecCmd() is able to pass the value ofONLY flag down to EnableDisableTrigger() using its new 'recurse'parameter.This also fixes what seems like an oversight of86f5759 that therecursion to partition triggers would only occur if EnableDisableTrigger()had actually changed the trigger. It is more apt to recurse to inspectpartition triggers even if the parent's trigger didn't need to bechanged: only then can we be certain that all descendants share the samestate afterwards.Backpatch all the way back to 11, likebbb927b. Care is taken notto break ABI compatibility (and that no catversion bump is needed.)Co-authored-by: Amit Langote <amitlangote09@gmail.com>Reviewed-by: Dmitry Koval <d.koval@postgrespro.ru>Discussion:https://postgr.es/m/CA+HiwqG-cZT3XzGAnEgZQLoQbyfJApVwOTQaCaas1mhpf+4V5A@mail.gmail.com