File tree Expand file tree Collapse file tree 3 files changed +29
-0
lines changed
localtests/panic-on-warnings-update-pk-with-duplicate-on-new-unique-index Expand file tree Collapse file tree 3 files changed +29
-0
lines changed Original file line number Diff line number Diff line change 1+ drop table if exists gh_ost_test;
2+ create table gh_ost_test (
3+ id int auto_increment,
4+ email varchar (100 ) not null ,
5+ primary key (id)
6+ ) auto_increment= 1 ;
7+
8+ insert into gh_ost_test (email) values (' alice@example.com' );
9+ insert into gh_ost_test (email) values (' bob@example.com' );
10+ insert into gh_ost_test (email) values (' charlie@example.com' );
11+
12+ drop event if exists gh_ost_test;
13+ delimiter ;;
14+ create event gh_ost_test
15+ on schedule every 1 second
16+ starts current_timestamp + interval 3 second
17+ ends current_timestamp + interval 60 second
18+ on completion not preserve
19+ enable
20+ do
21+ begin
22+ -- This UPDATE modifies the primary key, so it will be converted to DELETE + INSERT
23+ -- The INSERT will attempt to insert email='alice@example.com' (duplicate)
24+ -- which violates the new unique index being added by the migration
25+ -- Delay ensures this fires during binlog apply phase, not bulk copy
26+ update gh_ost_test set id= 10 , email= ' alice@example.com' where id= 2 ;
27+ end ;;
Original file line number Diff line number Diff line change 1+ Warnings detected during DML event application
Original file line number Diff line number Diff line change 1+ --panic-on-warnings --alter "ADD UNIQUE KEY email_unique (email)"
You can’t perform that action at this time.
0 commit comments