We have come across an interesting anomoly in MySQL behaviour in the
course of our investigations.  It seems that when A table is equiped
with both BEFORE INSERT and BEFORE DELETE triggers and a REPLACE
statement is used against that table, the INSERT trigger is fired
first and the DELETE trigger is fired afterwards..  this surprised us
as the REPLACE is supposed to fire a DELETE and then an INSERT. This
behavious was not found when using AFTER triggers which act is the
expected manner.

This was discovered by creating triggers which inserted a 'journal'
row into a temporary table (using an AUTO_INCREMENT) and then by
observing the resulting records.

This was observed in 5.0.34 Enterprise; we have not gone through other
versions to see if this bug is to be found elsewhere.



Happily, we are not using REPLACE (and have no intention or desire to
do it) in our application so this is not causing our project any real
inconvenience, but it could come as a nasty shock to some.

--
- michael dykman
- [EMAIL PROTECTED]

- All models are wrong.  Some models are useful.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to