The Daily MySQL Hate -- TRUNCATE should not be DELETE

Ovid on 2008-10-17T12:41:35

One of our developers recently installed Ubuntu on his desktop and is trying to run our code locally. The tests fail and we've tracked it down to this MySQL bug. In short, his "delete" triggers are firing when he tries to truncate tables. This behavior is wrong, but it actually wouldn't be a problem in our use case except that we get a "table not found" error on the trigger's target table, even though the table is clearly there. Issuing an identical statement with "delete from $table" works just fine.

This is MySQL 5.0.51, not a particularly old version. Our main MySQL server (which works just fine) is 5.0.37 and tests also pass on 5.0.67. Triggers in MySQL have always seemed a bit "hacked on" and this is continual reinforcement of "mysql sux" is yet another depressing issue for me.