diff options
author | Matthias Leich mleich@mysql.com <Unknown> | 2008-06-16 20:39:58 +0200 |
---|---|---|
committer | Matthias Leich mleich@mysql.com <Unknown> | 2008-06-16 20:39:58 +0200 |
commit | 28f9704737def200d6e608bce07cf2d437cc872e (patch) | |
tree | 8cd4d523083caecd55a18062b41b2911d0b054be /mysql-test/suite/funcs_1/triggers | |
parent | 15440264430b8dd7c10d950926a34f8f20f14427 (diff) | |
download | mariadb-git-28f9704737def200d6e608bce07cf2d437cc872e.tar.gz |
Fix for
Bug#37167 funcs_1: Many tests fail if the embedded server is used.
Bug#37164 funcs_1: Some tests fail if an optional character set is missing.
+ some cleanup within the testsuite related to the fixes above
+ some adjustments to open bugs on Mac OS X
Details:
- Remove the initial loading of data from tests if these data
are not somewhere retrieved
- Remove any use of columns with attribute unicode
(-> UCS2 is no more needed) from tests where unicode
properties are not checked or somehow required
- Create a separate branch of the Character maximum length test
(CML). If UCS2 is available than this test gets applied to
every available type of string column with attribute unicode
This prevents any loss of coverage by the points above.
- Disable the execution of is_tables_ndb which gives wrong
results because of a bug. Correct the exepected results of
this test.
- In case of tests failing when applied to the embedded server
1) Create a variant of this test for the embedded server
or
2) Skip the test in case of embedded server
depending on purpose and complexity of test.
- Skip the tests which could suffer from
Bug 28309 First insert violates unique constraint - was "memory" table empty ?
Bug 37380 Test funcs_1.is_columns_myisam_embedded fails on OS X
(both bugs Mac OS X, embedded server, MySQL 5.0 only)
- Minor improvements like remove typos
Diffstat (limited to 'mysql-test/suite/funcs_1/triggers')
-rw-r--r-- | mysql-test/suite/funcs_1/triggers/trig_frkey.inc | 147 | ||||
-rw-r--r-- | mysql-test/suite/funcs_1/triggers/triggers_03.inc | 4 |
2 files changed, 85 insertions, 66 deletions
diff --git a/mysql-test/suite/funcs_1/triggers/trig_frkey.inc b/mysql-test/suite/funcs_1/triggers/trig_frkey.inc index 5d6b6a72b1e..5aba368f531 100644 --- a/mysql-test/suite/funcs_1/triggers/trig_frkey.inc +++ b/mysql-test/suite/funcs_1/triggers/trig_frkey.inc @@ -1,50 +1,59 @@ ################################################################# -# This file inclde tests that address the foreign key cases of +# This file include 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. +# triggers_*.inc files. ################################################################# --disable_abort_on_error -#Section x.x.x.1 +# Section x.x.x.1 # Test case: Verifing that a trigger that activates a primary key results in # the primary key acting correctly on the foreign key let $message= Testcase x.x.x.1:; --source include/show_msg.inc - --disable_warnings - DROP TABLE IF EXISTS t0, t1, t2; - --enable_warnings - - eval CREATE TABLE t0 (col1 char(50)) ENGINE=$engine_type; - 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) - ON DELETE SET NULL) ENGINE=$engine_type; - - insert into t1 values (1,'Department A'); - insert into t1 values (2,'Department B'); - insert into t1 values (3,'Department C'); - insert into t2 values (1,2,'Emp 1'); - insert into t2 values (2,2,'Emp 2'); - insert into t2 values (3,2,'Emp 3'); - - create trigger trig after insert on t0 for each row - delete from t1 where col1=new.col1; - - select * from t2; -lock tables t0 write, t1 write; - insert into t0 values ('Department B'); -unlock tables; - select * from t2; +--disable_warnings +DROP TABLE IF EXISTS t0, t1, t2; +--enable_warnings + +--replace_result $engine_type <engine_to_be_tested> +eval +CREATE TABLE t0 (col1 CHAR(50)) +ENGINE = $engine_type; +--replace_result $engine_type <engine_to_be_tested> +eval +CREATE TABLE t1 (id INT NOT NULL, col1 CHAR(50), PRIMARY KEY (id)) +ENGINE = $engine_type; +--replace_result $engine_type <engine_to_be_tested> +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; + +INSERT INTO t1 VALUES (1,'Department A'); +INSERT INTO t1 VALUES (2,'Department B'); +INSERT INTO t1 VALUES (3,'Department C'); +INSERT INTO t2 VALUES (1,2,'Emp 1'); +INSERT INTO t2 VALUES (2,2,'Emp 2'); +INSERT INTO t2 VALUES (3,2,'Emp 3'); + +CREATE TRIGGER trig AFTER INSERT ON t0 FOR EACH ROW +DELETE FROM t1 WHERE col1 = new.col1; + +--sorted_result +SELECT * FROM t2; +LOCK TABLES t0 WRITE, t1 WRITE; +INSERT INTO t0 VALUES ('Department B'); +UNLOCK TABLES; +--sorted_result +SELECT * FROM t2; # Cleanup - drop trigger trig; - drop table t2, t1; +DROP TRIGGER trig; +DROP TABLE t2, t1; #Section x.x.x.2 @@ -53,41 +62,47 @@ unlock tables; let $message= Testcase x.x.x.2:; --source include/show_msg.inc - --disable_warnings - DROP TABLE IF EXISTS t1, t2; - --enable_warnings - - 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) - ON UPDATE CASCADE) ENGINE=$engine_type; - - insert into t1 values (1,'Department A'); - insert into t1 values (2,'Department B'); - insert into t1 values (3,'Department C'); - insert into t2 values (1,2,'Emp 1'); - insert into t2 values (2,3,'Emp 2'); - - --error 1452 - insert into t2 values (3,4,'Emp 3'); - - create trigger tr_t2 before insert on t2 for each row - insert into t1 values(new.f_id, concat('New Department ', new.f_id)); - -lock tables t1 write, t2 write; - insert into t2 values (3,4,'Emp 3'); -unlock tables; - - select * from t1; - select * from t2; +--disable_warnings +DROP TABLE IF EXISTS t1, t2; +--enable_warnings + +--replace_result $engine_type <engine_to_be_tested> +eval +CREATE TABLE t1 (id INT NOT NULL, col1 CHAR(50), PRIMARY KEY (id)) +ENGINE = $engine_type; +--replace_result $engine_type <engine_to_be_tested> +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 UPDATE CASCADE) +ENGINE = $engine_type; + +INSERT INTO t1 VALUES (1,'Department A'); +INSERT INTO t1 VALUES (2,'Department B'); +INSERT INTO t1 VALUES (3,'Department C'); +INSERT INTO t2 VALUES (1,2,'Emp 1'); +INSERT INTO t2 VALUES (2,3,'Emp 2'); + +--error ER_NO_REFERENCED_ROW_2 +insert into t2 VALUES (3,4,'Emp 3'); + +CREATE TRIGGER tr_t2 BEFORE INSERT ON t2 FOR EACH ROW +INSERT INTO t1 VALUES(new.f_id, CONCAT('New Department ', new.f_id)); + +LOCK TABLES t1 WRITE, t2 WRITE; +INSERT INTO t2 VALUES (3,4,'Emp 3'); +UNLOCK TABLES; + +--sorted_result +SELECT * FROM t1; +--sorted_result +SELECT * FROM t2; # Cleanup - drop trigger tr_t2; - drop table t2, t1, t0; - +DROP TRIGGER tr_t2; +DROP TABLE t2, t1, t0; -let $message= Foreign Key tests disabled (bug 11472 - stored in trig_frkey2.test); ---source include/show_msg.inc +--echo +--echo Foreign Key tests disabled (bug 11472 - stored in trig_frkey2.test) +--echo ------------------------------------------------------------------- diff --git a/mysql-test/suite/funcs_1/triggers/triggers_03.inc b/mysql-test/suite/funcs_1/triggers/triggers_03.inc index b0b98bf27e5..d0bfc5e9c0e 100644 --- a/mysql-test/suite/funcs_1/triggers/triggers_03.inc +++ b/mysql-test/suite/funcs_1/triggers/triggers_03.inc @@ -5,6 +5,10 @@ # (test case numbering refer to requirement document TP v1.1) #====================================================================== +# This test cannot be used for the embedded server because we check here +# privilgeges. +--source include/not_embedded.inc + USE test; --source suite/funcs_1/include/tb3.inc |