Postgres避免在删除级联上触发

时间:2013-05-21 13:16:01

标签: sql postgresql triggers cascade

您好我的触发器

有问题

我有2个

  • t_mandant
  • t_user_has_mandant

当我删除 t_user_has_mandant 中的一行时,我会调用触发器 beforeDeleteUserMandant() 但是当我从 t_mandant

中删除 mandant 时,我需要忽略触发器调用的可能性

因为 t_user_has_mandant 删除级联上的 t_mandant 上有外键

即时通讯使用postgres 8.4

1 个答案:

答案 0 :(得分:1)

阅读手册的this页。

使用变量

  

TG_TABLE_NAME

     

数据类型名称;导致该表的表的名称   触发器调用。

您可以确定DELETE是来自t_user_has_mandant还是t_mandant

相关问题