Commit 621a86ce authored by kroki@mysql.com's avatar kroki@mysql.com

Replace all numeric error code with symbolic names in trigger.test.

parent 9c3805c9
......@@ -237,7 +237,7 @@ begin
end|
delimiter ;|
insert into t3 values (1);
--error 1048
--error ER_BAD_NULL_ERROR
insert into t1 values (4, "four", 1), (5, "five", 2);
select * from t1;
select * from t2;
......@@ -295,19 +295,19 @@ drop table t1, t2;
create table t1 (i int);
create table t3 (i int);
--error 1363
--error ER_TRG_NO_SUCH_ROW_IN_TRG
create trigger trg before insert on t1 for each row set @a:= old.i;
--error 1363
--error ER_TRG_NO_SUCH_ROW_IN_TRG
create trigger trg before delete on t1 for each row set @a:= new.i;
--error 1362
--error ER_TRG_CANT_CHANGE_ROW
create trigger trg before update on t1 for each row set old.i:=1;
--error 1363
--error ER_TRG_NO_SUCH_ROW_IN_TRG
create trigger trg before delete on t1 for each row set new.i:=1;
--error 1362
--error ER_TRG_CANT_CHANGE_ROW
create trigger trg after update on t1 for each row set new.i:=1;
--error 1054
--error ER_BAD_FIELD_ERROR
create trigger trg before update on t1 for each row set new.j:=1;
--error 1054
--error ER_BAD_FIELD_ERROR
create trigger trg before update on t1 for each row set @a:=old.j;
......@@ -315,25 +315,25 @@ create trigger trg before update on t1 for each row set @a:=old.j;
# Let us test various trigger creation errors
# Also quickly test table namespace (bug#5892/6182)
#
--error 1146
--error ER_NO_SUCH_TABLE
create trigger trg before insert on t2 for each row set @a:=1;
create trigger trg before insert on t1 for each row set @a:=1;
--error 1359
--error ER_TRG_ALREADY_EXISTS
create trigger trg after insert on t1 for each row set @a:=1;
--error 1235
--error ER_NOT_SUPPORTED_YET
create trigger trg2 before insert on t1 for each row set @a:=1;
--error 1359
--error ER_TRG_ALREADY_EXISTS
create trigger trg before insert on t3 for each row set @a:=1;
create trigger trg2 before insert on t3 for each row set @a:=1;
drop trigger trg2;
drop trigger trg;
--error 1360
--error ER_TRG_DOES_NOT_EXIST
drop trigger trg;
create view v1 as select * from t1;
--error 1347
--error ER_WRONG_OBJECT
create trigger trg before insert on v1 for each row set @a:=1;
drop view v1;
......@@ -341,7 +341,7 @@ drop table t1;
drop table t3;
create temporary table t1 (i int);
--error 1361
--error ER_TRG_ON_VIEW_OR_TEMP_TABLE
create trigger trg before insert on t1 for each row set @a:=1;
drop table t1;
......@@ -495,47 +495,47 @@ select * from t1;
# their main effect. This is because operation on the table row is
# executed before "after" trigger and its effect cannot be rolled back
# when whole statement fails, because t1 is MyISAM table.
--error 1054
--error ER_BAD_FIELD_ERROR
insert into t1 values (2, 1);
select * from t1;
--error 1054
--error ER_BAD_FIELD_ERROR
update t1 set k = 2 where i = 2;
select * from t1;
--error 1054
--error ER_BAD_FIELD_ERROR
delete from t1 where i = 2;
select * from t1;
# Should fail and insert only 1 row
--error 1054
--error ER_BAD_FIELD_ERROR
load data infile '../std_data_ln/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (i, k);
select * from t1;
--error 1054
--error ER_BAD_FIELD_ERROR
insert into t1 select 3, 3;
select * from t1;
# Multi-update working on the fly, again it will update only
# one row even if more matches
--error 1054
--error ER_BAD_FIELD_ERROR
update t1, t2 set k = k + 10 where t1.i = t2.i;
select * from t1;
# The same for multi-update via temp table
--error 1054
--error ER_BAD_FIELD_ERROR
update t1, t2 set k = k + 10 where t1.i = t2.i and k < 3;
select * from t1;
# Multi-delete on the fly
--error 1054
--error ER_BAD_FIELD_ERROR
delete t1, t2 from t1 straight_join t2 where t1.i = t2.i;
select * from t1;
# And via temporary storage
--error 1054
--error ER_BAD_FIELD_ERROR
delete t2, t1 from t2 straight_join t1 where t1.i = t2.i;
select * from t1;
# Prepare table for testing of REPLACE and INSERT ... ON DUPLICATE KEY UPDATE
alter table t1 add primary key (i);
--error 1054
--error ER_BAD_FIELD_ERROR
insert into t1 values (3, 4) on duplicate key update k= k + 10;
select * from t1;
# The following statement will delete old row and won't
# insert new one since after delete trigger will fail.
--error 1054
--error ER_BAD_FIELD_ERROR
replace into t1 values (3, 3);
select * from t1;
# Also drops all triggers
......@@ -553,33 +553,33 @@ alter table t1 drop column bt;
# The following statements changing t1 should fail and should not
# cause any effect on table, since "before" trigger is executed
# before operation on the table row.
--error 1054
--error ER_BAD_FIELD_ERROR
insert into t1 values (3, 3);
select * from t1;
--error 1054
--error ER_BAD_FIELD_ERROR
update t1 set i = 2;
select * from t1;
--error 1054
--error ER_BAD_FIELD_ERROR
delete from t1;
select * from t1;
--error 1054
--error ER_BAD_FIELD_ERROR
load data infile '../std_data_ln/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (i, k);
select * from t1;
--error 1054
--error ER_BAD_FIELD_ERROR
insert into t1 select 3, 3;
select * from t1;
# Both types of multi-update (on the fly and via temp table)
--error 1054
--error ER_BAD_FIELD_ERROR
update t1, t2 set k = k + 10 where t1.i = t2.i;
select * from t1;
--error 1054
--error ER_BAD_FIELD_ERROR
update t1, t2 set k = k + 10 where t1.i = t2.i and k < 2;
select * from t1;
# Both types of multi-delete
--error 1054
--error ER_BAD_FIELD_ERROR
delete t1, t2 from t1 straight_join t2 where t1.i = t2.i;
select * from t1;
--error 1054
--error ER_BAD_FIELD_ERROR
delete t2, t1 from t2 straight_join t1 where t1.i = t2.i;
select * from t1;
# Let us test REPLACE/INSERT ... ON DUPLICATE KEY UPDATE.
......@@ -587,10 +587,10 @@ select * from t1;
# in ordinary INSERT we need to drop "before insert" trigger.
alter table t1 add primary key (i);
drop trigger bi;
--error 1054
--error ER_BAD_FIELD_ERROR
insert into t1 values (2, 4) on duplicate key update k= k + 10;
select * from t1;
--error 1054
--error ER_BAD_FIELD_ERROR
replace into t1 values (2, 4);
select * from t1;
# Also drops all triggers
......@@ -608,7 +608,7 @@ insert into t1 values (1, 2);
create function bug5893 () returns int return 5;
create trigger t1_bu before update on t1 for each row set new.col1= bug5893();
drop function bug5893;
--error 1305
--error ER_SP_DOES_NOT_EXIST
update t1 set col2 = 4;
# This should not crash server too.
drop trigger t1_bu;
......@@ -908,9 +908,9 @@ create trigger t1_bi after insert on t1 for each row insert into t3 values (new.
# Until we implement proper mechanism for invalidation of PS/SP when table
# or SP's are changed these two statements will fail with 'Table ... was
# not locked' error (this mechanism should be based on the new TDC).
--error 1100
--error 1100 #ER_TABLE_NOT_LOCKED
execute stmt1;
--error 1100
--error 1100 #ER_TABLE_NOT_LOCKED
call p1();
deallocate prepare stmt1;
drop procedure p1;
......@@ -1186,7 +1186,7 @@ INSERT INTO t1 VALUES (@x);
SELECT @x;
SET @x=2;
--error 1365
--error ER_DIVISION_BY_ZERO
UPDATE t1 SET i1 = @x;
SELECT @x;
......@@ -1197,7 +1197,7 @@ INSERT INTO t1 VALUES (@x);
SELECT @x;
SET @x=4;
--error 1365
--error ER_DIVISION_BY_ZERO
UPDATE t1 SET i1 = @x;
SELECT @x;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment