0

I have a MySQL trigger on an insert to table A that inserts a row in table B and an insert on table B that inserts a row on table A. The problem is they are firing each other in an endless loop, which the MySQL stops, since it isn't allowed.

How can I tell if I the insert is triggered from the other trigger and not do it?

hungary54
  • 767
  • 8
  • 11
  • 5
    maybe give him a suggestion on how to change the database in stead of just bashing him..? – Manuel May 22 '12 at 09:55
  • Dirty solution: You could set up a flag somewhere in your db, set it true when table A fires, Only let B insert something if the flag is true and set it to false. – Pieter888 May 22 '12 at 09:55
  • 1
    [How to avoid circular Trigger dependencies in MySQL](http://stackoverflow.com/questions/9570204/how-to-avoid-circular-trigger-dependencies-in-mysql) – Devart May 22 '12 at 10:01

0 Answers0