Commit a03cf24b authored by unknown's avatar unknown

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


mysql-test/t/trigger.test:
  Replace all numeric error code with symbolic names.
  Left are --error 1 for system error, and --error 1100.  The
  symbolic constant for the latter is ER_TABLE_NOT_LOCKED, but using
  it triggers a bug in test driver due to name prefix collision with
  1099 ER_TABLE_NOT_LOCKED_FOR_WRITE.  This bug is fixed in 5.1.
parent 6fa9d07f
...@@ -237,7 +237,7 @@ begin ...@@ -237,7 +237,7 @@ begin
end| end|
delimiter ;| delimiter ;|
insert into t3 values (1); insert into t3 values (1);
--error 1048 --error ER_BAD_NULL_ERROR
insert into t1 values (4, "four", 1), (5, "five", 2); insert into t1 values (4, "four", 1), (5, "five", 2);
select * from t1; select * from t1;
select * from t2; select * from t2;
...@@ -295,19 +295,19 @@ drop table t1, t2; ...@@ -295,19 +295,19 @@ drop table t1, t2;
create table t1 (i int); create table t1 (i int);
create table t3 (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; 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; 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; 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; 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; 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; 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; 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; ...@@ -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 # Let us test various trigger creation errors
# Also quickly test table namespace (bug#5892/6182) # 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 t2 for each row set @a:=1;
create trigger trg before insert on t1 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; 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; 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 trg before insert on t3 for each row set @a:=1;
create trigger trg2 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 trg2;
drop trigger trg; drop trigger trg;
--error 1360 --error ER_TRG_DOES_NOT_EXIST
drop trigger trg; drop trigger trg;
create view v1 as select * from t1; 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; create trigger trg before insert on v1 for each row set @a:=1;
drop view v1; drop view v1;
...@@ -341,7 +341,7 @@ drop table t1; ...@@ -341,7 +341,7 @@ drop table t1;
drop table t3; drop table t3;
create temporary table t1 (i int); 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; create trigger trg before insert on t1 for each row set @a:=1;
drop table t1; drop table t1;
...@@ -495,47 +495,47 @@ select * from t1; ...@@ -495,47 +495,47 @@ select * from t1;
# their main effect. This is because operation on the table row is # their main effect. This is because operation on the table row is
# executed before "after" trigger and its effect cannot be rolled back # executed before "after" trigger and its effect cannot be rolled back
# when whole statement fails, because t1 is MyISAM table. # when whole statement fails, because t1 is MyISAM table.
--error 1054 --error ER_BAD_FIELD_ERROR
insert into t1 values (2, 1); insert into t1 values (2, 1);
select * from t1; select * from t1;
--error 1054 --error ER_BAD_FIELD_ERROR
update t1 set k = 2 where i = 2; update t1 set k = 2 where i = 2;
select * from t1; select * from t1;
--error 1054 --error ER_BAD_FIELD_ERROR
delete from t1 where i = 2; delete from t1 where i = 2;
select * from t1; select * from t1;
# Should fail and insert only 1 row # 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); load data infile '../std_data_ln/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (i, k);
select * from t1; select * from t1;
--error 1054 --error ER_BAD_FIELD_ERROR
insert into t1 select 3, 3; insert into t1 select 3, 3;
select * from t1; select * from t1;
# Multi-update working on the fly, again it will update only # Multi-update working on the fly, again it will update only
# one row even if more matches # 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; update t1, t2 set k = k + 10 where t1.i = t2.i;
select * from t1; select * from t1;
# The same for multi-update via temp table # 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; update t1, t2 set k = k + 10 where t1.i = t2.i and k < 3;
select * from t1; select * from t1;
# Multi-delete on the fly # 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; delete t1, t2 from t1 straight_join t2 where t1.i = t2.i;
select * from t1; select * from t1;
# And via temporary storage # And via temporary storage
--error 1054 --error ER_BAD_FIELD_ERROR
delete t2, t1 from t2 straight_join t1 where t1.i = t2.i; delete t2, t1 from t2 straight_join t1 where t1.i = t2.i;
select * from t1; select * from t1;
# Prepare table for testing of REPLACE and INSERT ... ON DUPLICATE KEY UPDATE # Prepare table for testing of REPLACE and INSERT ... ON DUPLICATE KEY UPDATE
alter table t1 add primary key (i); 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; insert into t1 values (3, 4) on duplicate key update k= k + 10;
select * from t1; select * from t1;
# The following statement will delete old row and won't # The following statement will delete old row and won't
# insert new one since after delete trigger will fail. # insert new one since after delete trigger will fail.
--error 1054 --error ER_BAD_FIELD_ERROR
replace into t1 values (3, 3); replace into t1 values (3, 3);
select * from t1; select * from t1;
# Also drops all triggers # Also drops all triggers
...@@ -553,33 +553,33 @@ alter table t1 drop column bt; ...@@ -553,33 +553,33 @@ alter table t1 drop column bt;
# The following statements changing t1 should fail and should not # The following statements changing t1 should fail and should not
# cause any effect on table, since "before" trigger is executed # cause any effect on table, since "before" trigger is executed
# before operation on the table row. # before operation on the table row.
--error 1054 --error ER_BAD_FIELD_ERROR
insert into t1 values (3, 3); insert into t1 values (3, 3);
select * from t1; select * from t1;
--error 1054 --error ER_BAD_FIELD_ERROR
update t1 set i = 2; update t1 set i = 2;
select * from t1; select * from t1;
--error 1054 --error ER_BAD_FIELD_ERROR
delete from t1; delete from t1;
select * 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); load data infile '../std_data_ln/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (i, k);
select * from t1; select * from t1;
--error 1054 --error ER_BAD_FIELD_ERROR
insert into t1 select 3, 3; insert into t1 select 3, 3;
select * from t1; select * from t1;
# Both types of multi-update (on the fly and via temp table) # 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; update t1, t2 set k = k + 10 where t1.i = t2.i;
select * from t1; 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; update t1, t2 set k = k + 10 where t1.i = t2.i and k < 2;
select * from t1; select * from t1;
# Both types of multi-delete # 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; delete t1, t2 from t1 straight_join t2 where t1.i = t2.i;
select * from t1; select * from t1;
--error 1054 --error ER_BAD_FIELD_ERROR
delete t2, t1 from t2 straight_join t1 where t1.i = t2.i; delete t2, t1 from t2 straight_join t1 where t1.i = t2.i;
select * from t1; select * from t1;
# Let us test REPLACE/INSERT ... ON DUPLICATE KEY UPDATE. # Let us test REPLACE/INSERT ... ON DUPLICATE KEY UPDATE.
...@@ -587,10 +587,10 @@ select * from t1; ...@@ -587,10 +587,10 @@ select * from t1;
# in ordinary INSERT we need to drop "before insert" trigger. # in ordinary INSERT we need to drop "before insert" trigger.
alter table t1 add primary key (i); alter table t1 add primary key (i);
drop trigger bi; drop trigger bi;
--error 1054 --error ER_BAD_FIELD_ERROR
insert into t1 values (2, 4) on duplicate key update k= k + 10; insert into t1 values (2, 4) on duplicate key update k= k + 10;
select * from t1; select * from t1;
--error 1054 --error ER_BAD_FIELD_ERROR
replace into t1 values (2, 4); replace into t1 values (2, 4);
select * from t1; select * from t1;
# Also drops all triggers # Also drops all triggers
...@@ -608,7 +608,7 @@ insert into t1 values (1, 2); ...@@ -608,7 +608,7 @@ insert into t1 values (1, 2);
create function bug5893 () returns int return 5; create function bug5893 () returns int return 5;
create trigger t1_bu before update on t1 for each row set new.col1= bug5893(); create trigger t1_bu before update on t1 for each row set new.col1= bug5893();
drop function bug5893; drop function bug5893;
--error 1305 --error ER_SP_DOES_NOT_EXIST
update t1 set col2 = 4; update t1 set col2 = 4;
# This should not crash server too. # This should not crash server too.
drop trigger t1_bu; drop trigger t1_bu;
...@@ -908,9 +908,9 @@ create trigger t1_bi after insert on t1 for each row insert into t3 values (new. ...@@ -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 # 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 # 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). # not locked' error (this mechanism should be based on the new TDC).
--error 1100 --error 1100 #ER_TABLE_NOT_LOCKED
execute stmt1; execute stmt1;
--error 1100 --error 1100 #ER_TABLE_NOT_LOCKED
call p1(); call p1();
deallocate prepare stmt1; deallocate prepare stmt1;
drop procedure p1; drop procedure p1;
...@@ -1186,7 +1186,7 @@ INSERT INTO t1 VALUES (@x); ...@@ -1186,7 +1186,7 @@ INSERT INTO t1 VALUES (@x);
SELECT @x; SELECT @x;
SET @x=2; SET @x=2;
--error 1365 --error ER_DIVISION_BY_ZERO
UPDATE t1 SET i1 = @x; UPDATE t1 SET i1 = @x;
SELECT @x; SELECT @x;
...@@ -1197,7 +1197,7 @@ INSERT INTO t1 VALUES (@x); ...@@ -1197,7 +1197,7 @@ INSERT INTO t1 VALUES (@x);
SELECT @x; SELECT @x;
SET @x=4; SET @x=4;
--error 1365 --error ER_DIVISION_BY_ZERO
UPDATE t1 SET i1 = @x; UPDATE t1 SET i1 = @x;
SELECT @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