[英]Postgres avoid Trigger on delete cascade
Hello i have a problem with a Trigger 你好,我有一个触发器的问题
i have 2 tables : 我有2 张桌子 :
when i delete a row in t_user_has_mandant i call a trigger beforeDeleteUserMandant() but i need a possibility to ignore the trigger call when i delete a mandant from t_mandant 当我在t_user_has_mandant中 删除一行时,我在beforeDeleteUserMandant ()中调用触发器,但是当我从t_mandant中删除一个mandant时,我需要忽略触发器调用的可能性
because t_user_has_mandant has a foreign key on t_mandant which is on delete cascade . 因为t_user_has_mandant对t_mandant 外键是在删除级联 。
im using postgres 8.4 我正在使用postgres 8.4
Read this
page of the manual. 阅读this
手册的this
页。
Using the variable 使用变量
TG_TABLE_NAME TG_TABLE_NAME
Data type name; 数据类型名称; the name of the table that caused the trigger invocation. 引起触发器调用的表的名称。
You can determine if the DELETE
was from t_user_has_mandant
or t_mandant
. 您可以确定DELETE
是来自t_user_has_mandant
还是t_mandant
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.