Bug #18442 ALTER TABLE with trigger to same name will delete .TRG file
Submitted: 22 Mar 2006 23:19 Modified: 22 Mar 2006 23:41
Reporter: Magnus Blaudd
Status: Duplicate
Category:Server Severity:S2 (Serious)
Version:5.0 + 5.1 OS:Microsoft Windows (Windows)
Assigned to: Magnus Blaudd Target Version:

[22 Mar 2006 23:19] Magnus Blaudd
Description:
Altering a table  with trigger to the same name will delete the .TRG file and thus drop
all triggers for the table.

How to repeat:
create table t1 (id int not null primary key, data int);
create trigger t1_ai after insert on t1 for each row
  set @log:= 1;
alter table t1 add ts timestamp default now();

The t1.TRG file is now missing.

Suggested fix:
Dont delete the "from" file when the to file has same name.
[22 Mar 2006 23:19] Magnus Blaudd
The server does not have this behaviour on Linux.
[22 Mar 2006 23:41] Dmitri Lenev
Hi, Magnus!

This bug has the same cause (and the same fix) as bug #18153 "OPTIMIZE/ALTER on
transactional tables corrupt triggers" (which is already in patch pending state).
So I will mark this bug as duplicate.