MySQL Forums
Forum List  »  Triggers

Before Update trigger is also firing on insert, why?
Posted by: dean warren
Date: September 28, 2014 05:01AM

I have three tables, A, B and C where A is the parent of B, B is A's child. C is the history of B.

Below is a diagram showing the relationships and multiplicity (not both relationships are identifying).

1 0..*
A ------- B
| 1
|
| 0..*
C

The insert statement for B is of the form
insert into B ... on duplicate key update ...

There is a trigger in B such that before an update it copies the current row on B to C i.e. C is contains the history of B.

The above works create when there is no A. When A relationship is added I find that the trigger is fired twice, both on insert into B and update on B - why?

Thanks in advance.

Options: ReplyQuote


Subject
Views
Written By
Posted
Before Update trigger is also firing on insert, why?
2275
September 28, 2014 05:01AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.