简体   繁体   中英

Postgres avoid Trigger on delete cascade

Hello i have a problem with a Trigger

i have 2 tables :

  • t_mandant
  • t_user_has_mandant

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

because t_user_has_mandant has a foreign key on t_mandant which is on delete cascade .

im using postgres 8.4

Read this page of the manual.

Using the variable

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM