Prevent recursive trigger in PostgreSQL

前端 未结 4 1229
礼貌的吻别
礼貌的吻别 2020-11-29 06:38

How to prevent recursive execution of trigger? Let\'s say I want to construct a \"tree-able\" description on chart of account. So what I do is when a new record is inserted

4条回答
  •  隐瞒了意图╮
    2020-11-29 07:04

    At the beggining of the definition of the trigger you can disable triggers on that particular table, and reenable them at the end (and make sure an exception doesn't terminate the execution before expected!). This has many deep holes, but may work for some light implementations. Notice that for this implementation, you will also need priviliges to disable triggers.

提交回复
热议问题