1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-24 11:21:21 +03:00

Merge five.local.lan:/work/merge/mysql-5.0-Bug

into  five.local.lan:/work/merge/mysql-5.1-Bug
Addditional manual fixes will be needed.
This commit is contained in:
mleich@five.local.lan
2008-03-31 23:39:51 +02:00
95 changed files with 4692 additions and 7009 deletions

View File

@@ -1,17 +1,17 @@
#################################################################
# This file inclde tests that address the foreign key cases of
# the following requirements since they are specific to innodb.
# Other test cases for these requirements are included in the
# This file inclde tests that address the foreign key cases of
# the following requirements since they are specific to innodb.
# Other test cases for these requirements are included in the
# triggers_master.test file.
#################################################################
--disable_abort_on_error
# OBN - The following tests are disabled until triggers are supported with forign
# keys in innodb (foreign keys tests dispabled - bug 11472)
# keys in innodb (foreign keys tests dispabled - bug 11472)
#################################################################################
#Section x.x.x.3
# Test case: Similar to 3.5.10.5 but with ten tables to see if multiple triggers
# Test case: Similar to 3.5.10.5 but with ten tables to see if multiple triggers
# can be executed at once
let $message= Testcase x.x.x.3:;
--source include/show_msg.inc
@@ -21,58 +21,58 @@ let $message= Testcase x.x.x.3:;
--enable_warnings
eval CREATE TABLE t0 (col1 char(50)) ENGINE=$engine_type;
eval CREATE TABLE t1 (id INT NOT NULL, col1 char(50),
eval CREATE TABLE t1 (id INT NOT NULL, col1 char(50),
PRIMARY KEY (id)) ENGINE=$engine_type;
eval CREATE TABLE t2 (id INT PRIMARY KEY, f_id INT, INDEX par_ind
(f_id), col1 char(50), FOREIGN KEY (f_id) REFERENCES t1(id)
eval CREATE TABLE t2 (id INT PRIMARY KEY, f_id INT, INDEX par_ind
(f_id), col1 char(50), FOREIGN KEY (f_id) REFERENCES t1(id)
ON DELETE SET NULL) ENGINE=$engine_type;
eval CREATE TABLE t3 (id INT PRIMARY KEY, f_id INT, INDEX par_ind
(f_id), col1 char(50), FOREIGN KEY (f_id) REFERENCES t1(id)
eval CREATE TABLE t3 (id INT PRIMARY KEY, f_id INT, INDEX par_ind
(f_id), col1 char(50), FOREIGN KEY (f_id) REFERENCES t1(id)
ON DELETE SET NULL ON UPDATE CASCADE) ENGINE=$engine_type;
eval CREATE TABLE t4 (id INT PRIMARY KEY, f_id INT, INDEX par_ind
(f_id), col1 char(50), FOREIGN KEY (f_id) REFERENCES t1(id)
eval CREATE TABLE t4 (id INT PRIMARY KEY, f_id INT, INDEX par_ind
(f_id), col1 char(50), FOREIGN KEY (f_id) REFERENCES t1(id)
ON DELETE SET NULL ON UPDATE CASCADE) ENGINE=$engine_type;
eval CREATE TABLE t5 (id INT PRIMARY KEY, f_id INT, INDEX par_ind
(f_id), col1 char(50), FOREIGN KEY (f_id) REFERENCES t1(id)
eval CREATE TABLE t5 (id INT PRIMARY KEY, f_id INT, INDEX par_ind
(f_id), col1 char(50), FOREIGN KEY (f_id) REFERENCES t1(id)
ON DELETE SET NULL ON UPDATE CASCADE) ENGINE=$engine_type;
eval CREATE TABLE t6 (id INT PRIMARY KEY, f_id INT, INDEX par_ind
(f_id), col1 char(50), FOREIGN KEY (f_id) REFERENCES t1(id)
eval CREATE TABLE t6 (id INT PRIMARY KEY, f_id INT, INDEX par_ind
(f_id), col1 char(50), FOREIGN KEY (f_id) REFERENCES t1(id)
ON DELETE SET NULL ON UPDATE CASCADE) ENGINE=$engine_type;
eval CREATE TABLE t7 (id INT PRIMARY KEY, f_id INT, INDEX par_ind
(f_id), col1 char(50), FOREIGN KEY (f_id) REFERENCES t1(id)
eval CREATE TABLE t7 (id INT PRIMARY KEY, f_id INT, INDEX par_ind
(f_id), col1 char(50), FOREIGN KEY (f_id) REFERENCES t1(id)
ON DELETE SET NULL ON UPDATE CASCADE) ENGINE=$engine_type;
eval CREATE TABLE t8 (id INT PRIMARY KEY, f_id INT, INDEX par_ind
(f_id), col1 char(50), FOREIGN KEY (f_id) REFERENCES t1(id)
eval CREATE TABLE t8 (id INT PRIMARY KEY, f_id INT, INDEX par_ind
(f_id), col1 char(50), FOREIGN KEY (f_id) REFERENCES t1(id)
ON DELETE SET NULL ON UPDATE CASCADE) ENGINE=$engine_type;
eval CREATE TABLE t9 (id INT PRIMARY KEY, f_id INT, INDEX par_ind
(f_id), col1 char(50), FOREIGN KEY (f_id) REFERENCES t1(id)
eval CREATE TABLE t9 (id INT PRIMARY KEY, f_id INT, INDEX par_ind
(f_id), col1 char(50), FOREIGN KEY (f_id) REFERENCES t1(id)
ON DELETE SET NULL ON UPDATE CASCADE) ENGINE=$engine_type;
eval CREATE TABLE t10(id INT PRIMARY KEY, f_id INT, INDEX par_ind
(f_id), col1 char(50), FOREIGN KEY (f_id) REFERENCES t1(id)
eval CREATE TABLE t10(id INT PRIMARY KEY, f_id INT, INDEX par_ind
(f_id), col1 char(50), FOREIGN KEY (f_id) REFERENCES t1(id)
ON DELETE SET NULL ON UPDATE CASCADE) ENGINE=$engine_type;
eval CREATE TABLE t11(id INT PRIMARY KEY, f_id INT, INDEX par_ind
(f_id), col1 char(50), FOREIGN KEY (f_id) REFERENCES t1(id)
eval CREATE TABLE t11(id INT PRIMARY KEY, f_id INT, INDEX par_ind
(f_id), col1 char(50), FOREIGN KEY (f_id) REFERENCES t1(id)
ON DELETE SET NULL ON UPDATE CASCADE) ENGINE=$engine_type;
create trigger tr1 after update on t2 for each row
create trigger tr1 after update on t2 for each row
insert into t0 values ('tr_t2');
create trigger tr2 after update on t3 for each row
create trigger tr2 after update on t3 for each row
insert into t0 values ('tr_t3');
create trigger tr3 after update on t4 for each row
create trigger tr3 after update on t4 for each row
insert into t0 values ('tr_t4');
create trigger tr3 after update on t5 for each row
create trigger tr3 after update on t5 for each row
insert into t0 values ('tr_t5');
create trigger tr4 after update on t6 for each row
create trigger tr4 after update on t6 for each row
insert into t0 values ('tr_t6');
create trigger tr5 after update on t7 for each row
create trigger tr5 after update on t7 for each row
insert into t0 values ('tr_t7');
create trigger tr5 after update on t8 for each row
create trigger tr5 after update on t8 for each row
insert into t0 values ('tr_t8');
create trigger tr6 after update on t9 for each row
create trigger tr6 after update on t9 for each row
insert into t0 values ('tr_t9');
create trigger tr7 after update on t10 for each row
create trigger tr7 after update on t10 for each row
insert into t0 values ('tr_t10');
create trigger tr8 after update on t11 for each row
create trigger tr8 after update on t11 for each row
insert into t0 values ('tr_t11');
insert into t1 values (1,'Department A');
@@ -134,10 +134,10 @@ let $message= Testcase x.x.x.3:;
#Section 3.5.10.5
# Test case: Ensure that every trigger that should be activated by every possible
# type of implicit update of its subject table (e.g. a FOREIGN KEY SET
# DEFAULT action or an UPDATE of a view based on the subject table)
# is indeed activated correctly.
# Test case: Ensure that every trigger that should be activated by every possible
# type of implicit update of its subject table (e.g. a FOREIGN KEY SET
# DEFAULT action or an UPDATE of a view based on the subject table)
# is indeed activated correctly.
let $message= Testcase 3.5.10.5 (foreign keys):;
--source include/show_msg.inc
@@ -146,11 +146,11 @@ let $message= Testcase 3.5.10.5 (foreign keys):;
DROP TABLE IF EXISTS t1, t2;
--enable_warnings
eval CREATE TABLE t1 (id INT NOT NULL, col1 char(50),
eval CREATE TABLE t1 (id INT NOT NULL, col1 char(50),
PRIMARY KEY (id)) ENGINE=$engine_type;
eval CREATE TABLE t2 (id INT PRIMARY KEY, f_id INT,
INDEX par_ind (f_id), col1 char(50),
FOREIGN KEY (f_id) REFERENCES t1(id)
eval CREATE TABLE t2 (id INT PRIMARY KEY, f_id INT,
INDEX par_ind (f_id), col1 char(50),
FOREIGN KEY (f_id) REFERENCES t1(id)
ON DELETE SET NULL ON UPDATE CASCADE) ENGINE=$engine_type;
create trigger tr_t2 after update on t2
for each row set @counter=@counter+1;
@@ -191,9 +191,9 @@ let $message= Testcase 3.5.10.5 (foreign keys):;
#Section 3.5.10.6
# Test case: Ensure that every trigger that should be activated by every possible
# type of implicit deletion from its subject table (e.g. a FOREIGN KEY
# CASCADE action or a DELETE from a view based on the subject table)
# Test case: Ensure that every trigger that should be activated by every possible
# type of implicit deletion from its subject table (e.g. a FOREIGN KEY
# CASCADE action or a DELETE from a view based on the subject table)
# is indeed activated correctly.
let $message= Testcase 3.5.10.6 (foreign keys):;
--source include/show_msg.inc
@@ -202,11 +202,11 @@ let $message= Testcase 3.5.10.6 (foreign keys):;
DROP TABLE IF EXISTS t1, t2;
--enable_warnings
eval CREATE TABLE t1 (id INT NOT NULL, col1 char(50),
eval CREATE TABLE t1 (id INT NOT NULL, col1 char(50),
PRIMARY KEY (id)) ENGINE=$engine_type;
eval CREATE TABLE t2 (id INT PRIMARY KEY, f_id INT,
INDEX par_ind (f_id), col1 char(50),
FOREIGN KEY (f_id) REFERENCES t1(id)
eval CREATE TABLE t2 (id INT PRIMARY KEY, f_id INT,
INDEX par_ind (f_id), col1 char(50),
FOREIGN KEY (f_id) REFERENCES t1(id)
ON DELETE CASCADE) ENGINE=$engine_type;
create trigger tr_t2 before delete on t2

View File

@@ -1,7 +1,7 @@
#======================================================================
#
# Trigger Tests
# (test case numbering refer to requirement document TP v1.1)
# Trigger Tests
# (test case numbering refer to requirement document TP v1.1)
#======================================================================
# OBM - ToDo
@@ -20,37 +20,37 @@
# Testcase: Ensure that all clauses that should be supported are supported.
let $message= Testcase: 3.5.1.1:;
--source include/show_msg.inc
# OBN - This test case tests basic trigger definition and execution
# OBN - This test case tests basic trigger definition and execution
# of INSERT/UPDATE/DELETE actions and BEFORE/AFTER timings.
# As such it covers the equirements in sections 3.5.6.1, 3.5.6.2,
# As such it covers the equirements in sections 3.5.6.1, 3.5.6.2,
# 3.5.6.4, 3.5.6.5, 3.5.7.1, 3.5.7.2, 3.5.7.3, 3.5.7.17 below.
# - Note currently as a result of limitations with locking tables in
# - Note currently as a result of limitations with locking tables in
# triggers, a specifc lockingof the tables is done.
# Once fixed, the locking and alias referances should be removed
use test;
# Trigger Definition
Create trigger trg1_1 BEFORE INSERT
Create trigger trg1_1 BEFORE INSERT
on tb3 for each row set @test_before = 2, new.f142 = @test_before;
Create trigger trg1_2 AFTER INSERT
Create trigger trg1_2 AFTER INSERT
on tb3 for each row set @test_after = 6;
Create trigger trg1_4 BEFORE UPDATE
on tb3 for each row set @test_before = 27,
new.f142 = @test_before,
Create trigger trg1_4 BEFORE UPDATE
on tb3 for each row set @test_before = 27,
new.f142 = @test_before,
new.f122 = 'Before Update Trigger';
Create trigger trg1_3 AFTER UPDATE
Create trigger trg1_3 AFTER UPDATE
on tb3 for each row set @test_after = '15';
Create trigger trg1_5 BEFORE DELETE on tb3 for each row
select count(*) into @test_before from tb3 as tr_tb3
Create trigger trg1_5 BEFORE DELETE on tb3 for each row
select count(*) into @test_before from tb3 as tr_tb3
where f121 = 'Test 3.5.1.1';
Create trigger trg1_6 AFTER DELETE on tb3 for each row
select count(*) into @test_after from tb3 as tr_tb3
Create trigger trg1_6 AFTER DELETE on tb3 for each row
select count(*) into @test_after from tb3 as tr_tb3
where f121 = 'Test 3.5.1.1';
# Trigger Execution Insert (before and after)
set @test_before = 1;
set @test_after = 5;
select @test_before, @test_after;
Insert into tb3 (f121, f122, f142, f144, f134)
Insert into tb3 (f121, f122, f142, f144, f134)
values ('Test 3.5.1.1', 'First Row', @test_before, @test_after, 1);
select f121, f122, f142, f144, f134 from tb3 where f121 = 'Test 3.5.1.1';
select @test_before, @test_after;
@@ -59,15 +59,15 @@ use test;
set @test_before = 18;
set @test_after = 8;
select @test_before, @test_after;
Update tb3 set tb3.f122 = 'Update',
tb3.f142 = @test_before,
tb3.f144 = @test_after
Update tb3 set tb3.f122 = 'Update',
tb3.f142 = @test_before,
tb3.f144 = @test_after
where tb3.f121 = 'Test 3.5.1.1';
select f121, f122, f142, f144, f134 from tb3 where f121 = 'Test 3.5.1.1';
select @test_before, @test_after;
# Trigger Execution Delete (before and after)
Insert into tb3 (f121, f122, f142, f144, f134)
Insert into tb3 (f121, f122, f142, f144, f134)
values ('Test 3.5.1.1', 'Second Row', 5, 6, 2);
set @test_before = 0;
set @test_after = 0;
@@ -79,35 +79,35 @@ use test;
#Cleanup
--disable_warnings
--error 0, 1360
--error 0, ER_TRG_DOES_NOT_EXIST
drop trigger trg1_1;
--error 0, 1360
--error 0, ER_TRG_DOES_NOT_EXIST
drop trigger trg1_2;
--error 0, 1360
--error 0, ER_TRG_DOES_NOT_EXIST
drop trigger trg1_3;
--error 0, 1360
--error 0, ER_TRG_DOES_NOT_EXIST
drop trigger trg1_4;
--error 0, 1360
--error 0, ER_TRG_DOES_NOT_EXIST
drop trigger trg1_5;
--error 0, 1360
--error 0, ER_TRG_DOES_NOT_EXIST
drop trigger trg1_6;
--enable_warnings
delete from tb3 where f121='Test 3.5.1.1';
--enable_warnings
#Section 3.5.1.2
# Testcase: Ensure that all clauses that should not be supported are disallowed
# with an appropriate error message.
# Testcase: Ensure that all clauses that should not be supported are disallowed
# with an appropriate error message.
let $message= Testcase: 3.5.1.2:;
--source include/show_msg.inc
--error 1064
Create trigger trg_1 after insert
--error ER_PARSE_ERROR
Create trigger trg_1 after insert
on tb3 for each statement set @x= 1;
#Cleanup
--disable_warnings
--error 0, 1360
#Cleanup
--disable_warnings
--error 0, ER_TRG_DOES_NOT_EXIST
drop trigger trg_1;
--enable_warnings
@@ -116,66 +116,66 @@ let $message= Testcase: 3.5.1.2:;
# Testcase: Ensure that all supported clauses are supported only in the correct order.
let $message= Testcase 3.5.1.3:;
--source include/show_msg.inc
--error 1064
--error ER_PARSE_ERROR
CREATE TRIGGER trg3_1 on tb3 BEFORE INSERT for each row set new.f120 = 't';
--error 1064
--error ER_PARSE_ERROR
CREATE trg3_2 TRIGGER AFTER INSERT on tb3 for each row set new.f120 = 's';
--error 1064
--error ER_PARSE_ERROR
CREATE TRIGGER trg3_3 Before DELETE on tb3 set @ret1 = 'test' for each row;
--error 1064
--error ER_PARSE_ERROR
CREATE TRIGGER trg3_4 DELETE AFTER on tb3 set @ret1 = 'test' for each row;
--error 1064
CREATE for each row TRIGGER trg3_5 AFTER UPDATE on tb3 set @ret1 = 'test';
--error ER_PARSE_ERROR
CREATE for each row TRIGGER trg3_5 AFTER UPDATE on tb3 set @ret1 = 'test';
#Cleanup
# OBN - Although none of the above should have been created we should do a cleanup
# since if they have been created, not dropping them will affect following
# tests.
--disable_warnings
--error 0, 1360
--error 0, ER_TRG_DOES_NOT_EXIST
drop trigger trg3_1;
--error 0, 1360
--error 0, ER_TRG_DOES_NOT_EXIST
drop trigger trg3_2;
--error 0, 1360
--error 0, ER_TRG_DOES_NOT_EXIST
drop trigger trg3_3;
--error 0, 1360
--error 0, ER_TRG_DOES_NOT_EXIST
drop trigger trg3_4;
--error 0, 1360
--error 0, ER_TRG_DOES_NOT_EXIST
drop trigger trg3_5;
--enable_warnings
#Section 3.5.1.4
# Testcase: Ensure that an appropriate error message is returned if a clause
# Testcase: Ensure that an appropriate error message is returned if a clause
# is out-of-order in an SQL statement.
# OBN - FIXME - Missing 3.5.1.4 need to add
#Section 3.5.1.5
# Testcase: Ensure that all clauses that are defined to be mandatory are indeed
# Testcase: Ensure that all clauses that are defined to be mandatory are indeed
# required to be mandatory by the MySQL server and tools
let $message= Testcase: 3.5.1.5:;
--source include/show_msg.inc
--error 1064
--error ER_PARSE_ERROR
CREATE TRIGGER trg4_1 AFTER on tb3 for each row set new.f120 = 'e';
--error 1064
--error ER_PARSE_ERROR
CREATE TRIGGER trg4_2 INSERT on tb3 for each set row new.f120 = 'f';
--error 1064
--error ER_PARSE_ERROR
CREATE TRIGGER trg4_3 BEFORE INSERT tb3 for each row set new.f120 = 'g';
--error 1064
--error ER_PARSE_ERROR
CREATE TRIGGER trg4_4 AFTER UPDATE on tb3 for each set new.f120 = 'g';
--error 1064
--error ER_PARSE_ERROR
CREATE trg4_5 AFTER DELETE on tb3 for each set new.f120 = 'g';
--error 1064
--error ER_PARSE_ERROR
CREATE TRIGGER trg4_6 BEFORE DELETE for each row set new.f120 = 'g';
#Cleanup
@@ -183,19 +183,19 @@ let $message= Testcase: 3.5.1.5:;
# since if they have been created, not dropping them will affect following
# tests.
--disable_warnings
--error 0, 1360
--error 0, ER_TRG_DOES_NOT_EXIST
drop trigger trg4_1;
--error 0, 1360
--error 0, ER_TRG_DOES_NOT_EXIST
drop trigger trg4_2;
--error 0, 1360
--error 0, ER_TRG_DOES_NOT_EXIST
drop trigger trg4_3;
--error 0, 1360
--error 0, ER_TRG_DOES_NOT_EXIST
drop trigger trg4_4;
--error 0, 1360
--error 0, ER_TRG_DOES_NOT_EXIST
drop trigger trg4_5;
--error 0, 1360
--error 0, ER_TRG_DOES_NOT_EXIST
drop trigger trg4_6;
--enable_warnings
--enable_warnings
#Section 3.5.1.6
# Testcase: Ensure that any clauses that are defined to be optional are indeed
@@ -204,15 +204,15 @@ let $message= Testcase 3.5.1.6: - Need to fix;
--source include/show_msg.inc
# OBN - FIXME - Missing 3.5.1.6 need to add
#Section 3.5.1.7
# Testcase: Ensure that all valid, fully-qualified, and non-qualified,
#Section 3.5.1.7
# Testcase: Ensure that all valid, fully-qualified, and non-qualified,
# trigger names are accepted, at creation time.
let $message= Testcase 3.5.1.7: - need to fix;
--source include/show_msg.inc
drop table if exists t1;
eval create table t1 (f1 int, f2 char(25),f3 int) engine=$engine_type;
CREATE TRIGGER trg5_1 BEFORE INSERT on test.t1
CREATE TRIGGER trg5_1 BEFORE INSERT on test.t1
for each row set new.f3 = '14';
# In 5.0 names to long (more than 64 chars) were trimed without an error
# In 5.1 an error is returned. So adding a call with the expected error
@@ -230,8 +230,8 @@ let $message= Testcase 3.5.1.7: - need to fix;
select trigger_name from information_schema.triggers order by trigger_name;
#Cleanup
--disable_warnings
--error 0, 1360
--disable_warnings
--error 0, ER_TRG_DOES_NOT_EXIST
drop trigger trg5_1;
# In 5.1 the long name should generate an error that is to long
--error 1059
@@ -240,28 +240,28 @@ let $message= Testcase 3.5.1.7: - need to fix;
drop table t1;
#Section 3.5.1.8
# Testcase: Ensure that any invalid trigger name is never accepted, and that an
# Testcase: Ensure that any invalid trigger name is never accepted, and that an
# appropriate error message is returned when the name is rejected.
let $message= Testcase 3.5.1.8:;
--source include/show_msg.inc
--error 1064
--error ER_PARSE_ERROR
CREATE TRIGGER trg12* before insert on tb3 for each row set new.f120 = 't';
--error 1064
--error ER_PARSE_ERROR
CREATE TRIGGER trigger before insert on tb3 for each row set new.f120 = 't';
--error 1064
--error ER_PARSE_ERROR
CREATE TRIGGER 100 before insert on tb3 for each row set new.f120 = 't';
--error 1064
--error ER_PARSE_ERROR
CREATE TRIGGER @@view before insert on tb3 for each row set new.f120 = 't';
--error 1064
--error ER_PARSE_ERROR
CREATE TRIGGER @name before insert on tb3 for each row set new.f120 = 't';
--error 1435
CREATE TRIGGER tb3.trg6_1 BEFORE INSERT on test.tb3
--error ER_TRG_IN_WRONG_SCHEMA
CREATE TRIGGER tb3.trg6_1 BEFORE INSERT on test.tb3
for each row set new.f120 ='X';
--disable_warnings
@@ -273,29 +273,29 @@ let $message= Testcase 3.5.1.8:;
# Can't create a trigger in a different database
use test;
--error 1146
CREATE TRIGGER trig_db.trg6_2 AFTER INSERT on tb3
--error ER_NO_SUCH_TABLE
CREATE TRIGGER trig_db.trg6_2 AFTER INSERT on tb3
for each row set @ret_trg6_2 = 5;
# Can't create a trigger refrencing a table in a different db
use trig_db;
--error 1435
CREATE TRIGGER trg6_3 AFTER INSERT on test.tb3
--error ER_TRG_IN_WRONG_SCHEMA
CREATE TRIGGER trg6_3 AFTER INSERT on test.tb3
for each row set @ret_trg6_3 = 18;
use test;
#Cleanup
--disable_warnings
--disable_warnings
drop database trig_db;
# OBN - Although none of the above should have been created we should do a cleanup
# since if they have been created, not dropping them will affect following
# tests.
--error 0, 1360
--error 0, ER_TRG_DOES_NOT_EXIST
drop trigger trg6_1;
--error 0, 1360
--error 0, ER_TRG_DOES_NOT_EXIST
drop trigger trg6_3;
--enable_warnings
--enable_warnings
#Section 3.5.1.9
#Testcase: Ensure that a reference to a non-existent trigger is rejected with
@@ -305,41 +305,41 @@ let $message= Testcase 3.5.1.9:(cannot be inplemented at this point);
#Section 3.5.1.10
#Testcase: Ensure that it is not possible to create two triggers with the same name on
#Testcase: Ensure that it is not possible to create two triggers with the same name on
# the same table
let $message= Testcase 3.5.1.10:;
--source include/show_msg.inc
CREATE TRIGGER trg7_1 BEFORE UPDATE on tb3 for each row set new.f120 ='X';
--error 1359
--error ER_TRG_ALREADY_EXISTS
CREATE TRIGGER trg7_1 AFTER INSERT on tb3 for each row set @x ='Y';
#Cleanup
--disable_warnings
--error 0, 1360
--disable_warnings
--error 0, ER_TRG_DOES_NOT_EXIST
drop trigger trg7_1;
--enable_warnings
#Section 3.5.1.?
# Testcase: Ensure that it is not possible to create two or more triggers with
#Section 3.5.1.?
# Testcase: Ensure that it is not possible to create two or more triggers with
# the same name, provided each is associated with a different table.
let $message= Testcase 3.5.1.?:;
--source include/show_msg.inc
--disable_warnings
--disable_warnings
drop table if exists t1;
drop table if exists t2;
--enable_warnings
eval create table t1 (f1 char(50), f2 integer) engine = $engine_type;
eval create table t2 (f1 char(50), f2 integer) engine = $engine_type;
create trigger trig before insert on t1
create trigger trig before insert on t1
for each row set new.f1 ='trig t1';
--error 1359
create trigger trig before update on t2
--error ER_TRG_ALREADY_EXISTS
create trigger trig before update on t2
for each row set new.f1 ='trig t2';
insert into t1 value ('insert to t1',1);
@@ -351,16 +351,16 @@ let $message= Testcase 3.5.1.?:;
select * from t2;
#Cleanup
--disable_warnings
--disable_warnings
drop table t1;
drop table t2;
--error 0, 1360
--error 0, ER_TRG_DOES_NOT_EXIST
drop trigger trig;
--enable_warnings
#Section 3.5.1.11
# Testcase: Ensure that it is possible to create two or more triggers with
#Section 3.5.1.11
# Testcase: Ensure that it is possible to create two or more triggers with
# the same name, provided each resides in a different database
let $message= Testcase 3.5.1.11:;
--source include/show_msg.inc
@@ -375,15 +375,15 @@ let $message= Testcase 3.5.1.11:;
create database trig_db3;
use trig_db1;
eval create table t1 (f1 char(50), f2 integer) engine = $engine_type;
create trigger trig before insert on t1
create trigger trig before insert on t1
for each row set new.f1 ='trig1', @test_var1='trig1';
use trig_db2;
eval create table t2 (f1 char(50), f2 integer) engine = $engine_type;
create trigger trig before insert on t2
create trigger trig before insert on t2
for each row set new.f1 ='trig2', @test_var2='trig2';
use trig_db3;
eval create table t1 (f1 char(50), f2 integer) engine = $engine_type;
create trigger trig before insert on t1
create trigger trig before insert on t1
for each row set new.f1 ='trig3', @test_var3='trig3';
set @test_var1= '', @test_var2= '', @test_var3= '';
@@ -400,7 +400,7 @@ let $message= Testcase 3.5.1.11:;
use test;
#Cleanup
--disable_warnings
--disable_warnings
drop database trig_db1;
drop database trig_db2;
drop database trig_db3;
@@ -411,16 +411,16 @@ let $message= Testcase 3.5.1.11:;
# Check for the global nature of Triggers #
###########################################
#Section 3.5.2.1
# Test case: Ensure that if a trigger created without a qualifying database
#Section 3.5.2.1
# Test case: Ensure that if a trigger created without a qualifying database
# name belongs to the database in use at creation time.
#Section 3.5.2.2
# Test case: Ensure that if a trigger created with a qualifying database name
#Section 3.5.2.2
# Test case: Ensure that if a trigger created with a qualifying database name
# belongs to the database specified.
#Section 3.5.2.3
# Test case: Ensure that if a trigger created with a qualifying database name
# does not belong to the database in use at creation time unless
# the qualifying database name identifies the database that is
#Section 3.5.2.3
# Test case: Ensure that if a trigger created with a qualifying database name
# does not belong to the database in use at creation time unless
# the qualifying database name identifies the database that is
# also in use at creation time.
let $message= Testcase 3.5.2.1/2/3:;
--source include/show_msg.inc
@@ -435,11 +435,11 @@ let $message= Testcase 3.5.2.1/2/3:;
use trig_db1;
eval create table t1 (f1 char(50), f2 integer) engine = $engine_type;
eval create table trig_db2.t1 (f1 char(50), f2 integer) engine = $engine_type;
create trigger trig1_b before insert on t1
create trigger trig1_b before insert on t1
for each row set @test_var1='trig1_b';
create trigger trig_db1.trig1_a after insert on t1
create trigger trig_db1.trig1_a after insert on t1
for each row set @test_var2='trig1_a';
create trigger trig_db2.trig2 before insert on trig_db2.t1
create trigger trig_db2.trig2 before insert on trig_db2.t1
for each row set @test_var3='trig2';
select trigger_schema, trigger_name, event_object_table
from information_schema.triggers order by trigger_name;
@@ -450,6 +450,6 @@ let $message= Testcase 3.5.2.1/2/3:;
select @test_var1, @test_var2, @test_var3;
#Cleanup
--disable_warnings
--disable_warnings
drop database trig_db1;
drop database trig_db2;

View File

@@ -95,8 +95,8 @@ let $message= Testcase 3.5.10.4:;
set @counter= 0;
select @counter as 'Rows Loaded Before';
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
eval load data infile '$MYSQL_TEST_DIR/suite/funcs_1/data/t9.txt' into table tb_load;
--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
eval load data infile '$MYSQLTEST_VARDIR/std_data_ln/funcs_1/t9.txt' into table tb_load;
select @counter as 'Rows Loaded After';
Select * from tb_load order by f1 limit 10;
@@ -158,7 +158,7 @@ let $message= Testcase 3.5.10.extra:;
set @counter=0;
select @counter;
--error 1329
--error ER_SP_FETCH_NO_DATA
call trig_sp();
select @counter;
select count(*) from tb3;
@@ -328,7 +328,7 @@ set @sql_mode='traditional';
set @counter=0;
select @counter;
--error 1456
--error ER_SP_RECURSION_LIMIT
call trig_sp();
select @counter;
select count(*) from tb3;
@@ -338,7 +338,7 @@ set @sql_mode='traditional';
set @@max_sp_recursion_depth= 10;
set @counter=0;
select @counter;
--error 1442
--error ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG
call trig_sp();
select @counter;
select count(*) from tb3;
@@ -382,7 +382,7 @@ let $message= Testcase y.y.y.5: Roleback of nested trigger references;
set autocommit=0;
start transaction;
--error 1264
--error ER_WARN_DATA_OUT_OF_RANGE
insert into t1 values (1);
commit;
select * from t1 order by f1;

File diff suppressed because it is too large Load Diff