~vkolesnikov/pbxt/pbxt-preload-test-bug

« back to all changes in this revision

Viewing changes to test/mysql-test/t/pbxt_bugs.test

  • Committer: Paul McCullagh
  • Date: 2010-02-02 10:06:03 UTC
  • Revision ID: paul.mccullagh@primebase.org-20100202100603-3l4xe7gc5yvo9tds
Fixed bug #513012: On a table with a trigger the same record is updated more than once in one statement

Show diffs side-by-side

added added

removed removed

Lines of Context:
1036
1036
drop table t2, t1;
1037
1037
 
1038
1038
--disable_query_log
1039
 
 
1040
1039
DROP TABLE t5;
 
1040
--enable_query_log
 
1041
 
 
1042
 
 
1043
# bug 513012: On a table with a trigger the same record is updated more than once in one statement
 
1044
 
 
1045
--disable_query_log
 
1046
--disable_result_log
 
1047
create table tb0_eng2 (
 
1048
i1 int NOT NULL auto_increment, primary key (i1),
 
1049
        f1 int,
 
1050
        f2 char (32));
 
1051
 
 
1052
insert into tb0_eng2 (f1,f2) values (7, 'init_val'), (14, 'init_val'),
 
1053
 (10, 'init_val'), (14, 'init_val'), (4, 'init_val');
 
1054
 
 
1055
CREATE TABLE tb0_logs (
 
1056
        i1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (i1),
 
1057
        entry_dsc CHAR(100) );
 
1058
 
 
1059
Create trigger tb0_eng2_upd after update on tb0_eng2 for each row
 
1060
        insert into tb0_logs (entry_dsc)
 
1061
                values (concat('Update row ', old.i1, ' ', old.f2, ' -> ', new.f2));
 
1062
 
 
1063
let $run=1;
 
1064
let $counter=0;
 
1065
 
 
1066
while ($run)
 
1067
{
 
1068
        inc $counter;
 
1069
        let $prev_log = `SELECT COUNT(*) FROM tb0_logs`;
 
1070
 
 
1071
        eval update tb0_eng2 set f2='Update #$counter' where f1=10;
 
1072
 
 
1073
        let $new_log = `SELECT COUNT(*) FROM tb0_logs`;
 
1074
        let $run = `SELECT $new_log-$prev_log=1`;
 
1075
 
 
1076
        --echo # ROUND $counter finished, prev log count = $prev_log, new log count = $new_log
 
1077
        if (`SELECT $counter>=500`)
 
1078
        {
 
1079
                --echo # Could not reproduce the problem in $counter iterations
 
1080
                exit;
 
1081
        }
 
1082
}
 
1083
--enable_query_log
 
1084
--enable_result_log
 
1085
select * from tb0_logs order by i1 desc limit 5;
 
1086
 
 
1087
--disable_query_log
 
1088
drop trigger tb0_eng2;
 
1089
drop table tb0_eng2, tb0_logs;
1041
1090
drop database pbxt;
1042
1091
--enable_query_log
 
1092