mirror of
				https://github.com/MariaDB/server.git
				synced 2025-10-24 07:13:33 +03:00 
			
		
		
		
	Cleanup the sideeffects from most of the testcases with sideeffects. mysql-test/mysql-test-run.pl: Add option "check-testcases" to mysql-test-run.pl Will execute "include/check-testcase.test" once before each tescase and record the output into "var/tmp/check-testcase.result" After the teastcase it will run again and this time compare the output with previously recorded file. mysql-test/r/analyze.result: Drop table t1 at end of test mysql-test/r/create_select_tmp.result: Drop table t1 at end of test mysql-test/r/ctype_cp932.result: Drop table t1 at end of test mysql-test/r/ctype_recoding.result: Drop table t1 at end of test mysql-test/r/grant2.result: Drop user mysqltest_2 and mysqltest_A@'%' mysql-test/r/join_outer.result: Drop view v1 to cleanup mysql-test/r/ps_1general.result: Drop table t1 at end of test mysql-test/r/query_cache.result: Drop function "f1" mysql-test/r/read_only.result: Reset the "read_only" flag mysql-test/r/rpl000001.result: Remove user "blafasel2" mysql-test/r/rpl000017.result: Remove user "replicate" mysql-test/r/rpl_failed_optimize.result: Drop table t1 to cleanup mysql-test/r/rpl_flush_tables.result: Drop tables t3, t4, t5 mysql-test/r/rpl_ignore_revoke.result: Delete user "user_foo" mysql-test/r/rpl_insert_id.result: Drop table t1 to cleanup mysql-test/r/rpl_loaddata.result: Drop tyable t1 to cleanup mysql-test/r/rpl_loaddata_rule_m.result: Drop tyable t1 to cleanup mysql-test/r/rpl_loaddata_rule_s.result: Drop tyable t1 to cleanup mysql-test/r/rpl_misc_functions.result: Drop tyable t1 to cleanup mysql-test/r/rpl_multi_update3.result: Drop tyable t1 and t2 to cleanup mysql-test/r/rpl_replicate_do.result: Drop tyable t1 to cleanup mysql-test/r/rpl_skip_error.result: Drop tyable t1 to cleanup mysql-test/r/rpl_slave_status.result: Drop tyable t1 to cleanup mysql-test/r/sp-prelocking.result: Drop view v1 and tables t1, t2, t3 and t4 to cleanup mysql-test/r/sp-security.result: Delete users to cleanup Delete remaining traces in tables_priv and procs_priv mysql-test/r/subselect_innodb.result: Drop procedure p1 to cleanup mysql-test/r/trigger-compat.result: Drop trigger wl2818_trg1 and wl2818_trg2. Drop table t1, t2 Drop database mysqltest_db1 And the users "mysqltest_dfn@localhost" and "mysqltest_inv@localhost" mysql-test/r/type_bit.result: Drop tables t1 and t2 to cleanup mysql-test/r/variables.result: Set GLOBAL max_join_size to 10 as it originally was in variables-master.opt mysql-test/r/view_grant.result: Dop user "test@localhost" to cleanup mysql-test/t/analyze.test: Drop table t1 to cleanup mysql-test/t/create_select_tmp.test: Drop table t1 to cleanup mysql-test/t/ctype_cp932.test: Drop table t1 to cleanup mysql-test/t/ctype_recoding.test: Drop table t1 to cleanup mysql-test/t/fulltext_var.test: Restore the original ft_boolean_syntax mysql-test/t/grant2.test: Drop users "mysqltest_2" and "mysqltest_A@'%'" to cleanup mysql-test/t/innodb_cache.test: Reset query_cache_size to original value mysql-test/t/join_outer.test: Drop view v1 to cleanup mysql-test/t/ps_1general.test: Drop table t1 to cleanup mysql-test/t/query_cache.test: Drop function "f1" to cleanup mysql-test/t/read_only.test: Reset the readonly flag mysql-test/t/rpl000001.test: Delete user "blafasel2" to cleanup mysql-test/t/rpl000017.test: Delete user "replicate" to cleanup mysql-test/t/rpl_failed_optimize.test: Drop table t1 to cleanup mysql-test/t/rpl_flush_tables.test: Droip table t3, t4 and t5 to cleanup mysql-test/t/rpl_ignore_revoke.test: Delet user "user_foo" to cleanup mysql-test/t/rpl_insert_id.test: drop table t1 to cleanup mysql-test/t/rpl_loaddata.test: Drop table t1 to cleanup mysql-test/t/rpl_loaddata_rule_m.test: Drop table t1 to cleanup mysql-test/t/rpl_loaddata_rule_s.test: Drop table t1 to cleanup mysql-test/t/rpl_misc_functions.test: Drop table t1 to cleanup mysql-test/t/rpl_multi_update3.test: Drop table t1 and t2 to cleanup mysql-test/t/rpl_replicate_do.test: Drop table t1 to cleanup mysql-test/t/rpl_skip_error.test: Drop table t1 to cleanup mysql-test/t/rpl_slave_status.test: Drop table t1 to cleanup mysql-test/t/sp-prelocking.test: Drop table t1, t2 t3 and t4 to cleanup Drop view v1 mysql-test/t/sp-security.test: Delete test users from mysql.user, mysql.db, mysql.procs_priv and mysql.tables_priv Drop table t1 to cleanup mysql-test/t/subselect_innodb.test: Drop procedure p1 to cleanup mysql-test/t/trigger-compat.test: Drop trigger wl2818_trg1 and wl2818_trg2 to cleanup Drop table t1, t2 Drop users drop database mysqltest_db1 mysql-test/t/type_bit.test: drop table t1 and t2 to cleanup mysql-test/t/variables-master.opt: Increase max_join_size to 100. mysql-test/t/variables.test: Set max_join_size to 10, which was the original value in variables-master.opt mysql-test/t/view_grant.test: Drop the user "test@localhost" mysql-test/include/check-testcase.test: New BitKeeper file ``mysql-test/include/check-testcase.test''
		
			
				
	
	
		
			248 lines
		
	
	
		
			8.0 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			248 lines
		
	
	
		
			8.0 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| drop table if exists t1,t2,t3;
 | |
| CREATE TABLE t1
 | |
| (
 | |
| FOLDERID VARCHAR(32)BINARY NOT NULL
 | |
| , FOLDERNAME VARCHAR(255)BINARY NOT NULL
 | |
| , CREATOR VARCHAR(255)BINARY
 | |
| , CREATED TIMESTAMP NOT NULL
 | |
| , DESCRIPTION VARCHAR(255)BINARY
 | |
| , FOLDERTYPE INTEGER NOT NULL
 | |
| , MODIFIED TIMESTAMP
 | |
| , MODIFIER VARCHAR(255)BINARY
 | |
| , FOLDERSIZE INTEGER NOT NULL
 | |
| , PARENTID VARCHAR(32)BINARY
 | |
| , REPID VARCHAR(32)BINARY
 | |
| , ORIGINATOR INTEGER
 | |
| , PRIMARY KEY ( FOLDERID )
 | |
| ) ENGINE=InnoDB;
 | |
| CREATE INDEX FFOLDERID_IDX ON t1 (FOLDERID);
 | |
| CREATE INDEX CMFLDRPARNT_IDX ON t1 (PARENTID);
 | |
| INSERT INTO t1 VALUES("0c9aab05b15048c59bc35c8461507deb", "System", "System", "2003-06-05 16:30:00", "The system content repository folder.", "3", "2003-06-05 16:30:00", "System", "0", NULL, "9c9aab05b15048c59bc35c8461507deb", "1");
 | |
| INSERT INTO t1 VALUES("2f6161e879db43c1a5b82c21ddc49089", "Default", "System", "2003-06-09 10:52:02", "The default content repository folder.", "3", "2003-06-05 16:30:00", "System", "0", NULL, "03eea05112b845949f3fd03278b5fe43", "1");
 | |
| INSERT INTO t1 VALUES("c373e9f5ad0791724315444553544200", "AddDocumentTest", "admin", "2003-06-09 10:51:25", "Movie Reviews", "0", "2003-06-09 10:51:25", "admin", "0", "2f6161e879db43c1a5b82c21ddc49089", "03eea05112b845949f3fd03278b5fe43", NULL);
 | |
| SELECT 'c373e9f5ad0791a0dab5444553544200' IN(SELECT t1.FOLDERID FROM t1 WHERE t1.PARENTID='2f6161e879db43c1a5b82c21ddc49089' AND t1.FOLDERNAME = 'Level1');
 | |
| 'c373e9f5ad0791a0dab5444553544200' IN(SELECT t1.FOLDERID FROM t1 WHERE t1.PARENTID='2f6161e879db43c1a5b82c21ddc49089' AND t1.FOLDERNAME = 'Level1')
 | |
| 0
 | |
| drop table t1;
 | |
| create table t1 (a int) engine=innodb;
 | |
| create table t2 (a int) engine=innodb;
 | |
| create table t3 (a int) engine=innodb;
 | |
| insert into t1 values (1),(2),(3),(4);
 | |
| insert into t2 values (10),(20),(30),(40);
 | |
| insert into t3 values (1),(2),(10),(50);
 | |
| select a from t3 where t3.a in (select a from t1 where a <= 3 union select * from t2 where a <= 30);
 | |
| a
 | |
| 1
 | |
| 2
 | |
| 10
 | |
| drop table t1,t2,t3;
 | |
| CREATE TABLE t1 (
 | |
| processor_id INTEGER NOT NULL,
 | |
| PRIMARY KEY (processor_id)
 | |
| ) ENGINE=InnoDB;
 | |
| CREATE TABLE t3 (
 | |
| yod_id BIGINT UNSIGNED AUTO_INCREMENT NOT NULL,
 | |
| login_processor INTEGER UNSIGNED ,
 | |
| PRIMARY KEY (yod_id)
 | |
| ) ENGINE=InnoDB;
 | |
| CREATE TABLE t2 (
 | |
| processor_id INTEGER NOT NULL,
 | |
| yod_id BIGINT UNSIGNED NOT NULL,
 | |
| PRIMARY KEY (processor_id, yod_id),
 | |
| INDEX (processor_id),
 | |
| INDEX (yod_id),
 | |
| FOREIGN KEY (processor_id) REFERENCES t1(processor_id),
 | |
| FOREIGN KEY (yod_id) REFERENCES t3(yod_id) 
 | |
| ) ENGINE=InnoDB;
 | |
| INSERT INTO t1 VALUES (1),(2),(3);
 | |
| INSERT INTO t3 VALUES (1,1),(2,2),(3,3);
 | |
| INSERT INTO t2 VALUES (1,1),(2,2),(3,3);
 | |
| SELECT distinct p1.processor_id, (SELECT y.yod_id FROM t1 p2, t2 y WHERE p2.processor_id = p1.processor_id and p2.processor_id = y.processor_id) FROM t1 p1;
 | |
| processor_id	(SELECT y.yod_id FROM t1 p2, t2 y WHERE p2.processor_id = p1.processor_id and p2.processor_id = y.processor_id)
 | |
| 1	1
 | |
| 2	2
 | |
| 3	3
 | |
| drop table t2,t1,t3;
 | |
| CREATE TABLE t1 (
 | |
| id int(11) NOT NULL default '0',
 | |
| b int(11) default NULL,
 | |
| c char(3) default NULL,
 | |
| PRIMARY KEY  (id),
 | |
| KEY t2i1 (b)
 | |
| ) ENGINE=innodb DEFAULT CHARSET=latin1;
 | |
| INSERT INTO t1 VALUES (0,0,'GPL'),(1,0,'GPL'),(2,1,'GPL'),(3,2,'GPL');
 | |
| CREATE TABLE t2 (
 | |
| id int(11) NOT NULL default '0',
 | |
| b int(11) default NULL,
 | |
| c char(3) default NULL,
 | |
| PRIMARY KEY  (id),
 | |
| KEY t2i (b)
 | |
| ) ENGINE=innodb DEFAULT CHARSET=latin1;
 | |
| INSERT INTO t2 VALUES (0,0,'GPL'),(1,0,'GPL'),(2,1,'GPL'),(3,2,'GPL');
 | |
| select (select max(id) from t2 where b=1 group by b) as x,b from t1 where b=1;
 | |
| x	b
 | |
| 2	1
 | |
| drop table t1,t2;
 | |
| create table t1 (id int not null, value char(255), primary key(id)) engine=innodb;
 | |
| create table t2 (id int not null, value char(255)) engine=innodb;
 | |
| insert into t1 values (1,'a'),(2,'b');
 | |
| insert into t2 values (1,'z'),(2,'x');
 | |
| select t2.id,t2.value,(select t1.value from t1 where t1.id=t2.id) from t2;
 | |
| id	value	(select t1.value from t1 where t1.id=t2.id)
 | |
| 1	z	a
 | |
| 2	x	b
 | |
| select t2.id,t2.value,(select t1.value from t1 where t1.id=t2.id) from t2;
 | |
| id	value	(select t1.value from t1 where t1.id=t2.id)
 | |
| 1	z	a
 | |
| 2	x	b
 | |
| drop table t1,t2;
 | |
| create table t1 (a int, b int) engine=innodb;
 | |
| insert into t1 values (1,2), (1,3), (2,3), (2,4), (2,5), (3,4), (4,5), (4,100);
 | |
| create table t2 (a int) engine=innodb;
 | |
| insert into t2 values (1),(2),(3),(4);
 | |
| select a, sum(b) as b from t1 group by a having b > (select max(a) from t2);
 | |
| a	b
 | |
| 1	5
 | |
| 2	12
 | |
| 4	105
 | |
| drop table t1, t2;
 | |
| CREATE TABLE `t1` ( `unit` varchar(50) NOT NULL default '', `ingredient` varchar(50) NOT NULL default '') ENGINE=InnoDB DEFAULT CHARSET=latin1;
 | |
| CREATE TABLE `t2` ( `ingredient` varchar(50) NOT NULL default '', `unit` varchar(50) NOT NULL default '', PRIMARY KEY (ingredient, unit)) ENGINE=InnoDB DEFAULT CHARSET=latin1;
 | |
| INSERT INTO `t1` VALUES ('xx','yy');
 | |
| INSERT INTO `t2` VALUES ('yy','xx');
 | |
| SELECT R.unit, R.ingredient FROM t1 R WHERE R.ingredient IN (SELECT N.ingredient FROM t2 N WHERE N.unit = R.unit);
 | |
| unit	ingredient
 | |
| xx	yy
 | |
| drop table t1, t2;
 | |
| CREATE TABLE t1 (
 | |
| id INT NOT NULL auto_increment,
 | |
| date1 DATE, coworkerid INT,
 | |
| description VARCHAR(255),
 | |
| sum_used DOUBLE,
 | |
| sum_remaining DOUBLE,
 | |
| comments VARCHAR(255),
 | |
| PRIMARY KEY(id)
 | |
| ) engine=innodb;
 | |
| insert into t1 values (NULL, '1999-01-01', 1,'test', 22, 33, 'comment'), (NULL, '1999-01-01', 1,'test', 22, 33, 'comment'), (NULL, '1999-01-01', 1,'test', 22, 33, 'comment'), (NULL, '1998-01-01', 1,'test', 22, 33, 'comment'), (NULL, '1998-01-01', 1,'test', 22, 33, 'comment'), (NULL, '2004-01-01', 1,'test', 22, 33, 'comment'), (NULL, '2004-01-01', 1,'test', 22, 33, 'comment');
 | |
| SELECT DISTINCT
 | |
| (SELECT sum(sum_used) FROM t1 WHERE sum_used > 0 AND year(date1) <= '2004') as somallontvangsten,
 | |
| (SELECT sum(sum_used) FROM t1 WHERE sum_used < 0 AND year(date1) <= '2004') as somalluitgaven
 | |
| FROM t1;
 | |
| somallontvangsten	somalluitgaven
 | |
| 154	NULL
 | |
| select * from t1;
 | |
| id	date1	coworkerid	description	sum_used	sum_remaining	comments
 | |
| 1	1999-01-01	1	test	22	33	comment
 | |
| 2	1999-01-01	1	test	22	33	comment
 | |
| 3	1999-01-01	1	test	22	33	comment
 | |
| 4	1998-01-01	1	test	22	33	comment
 | |
| 5	1998-01-01	1	test	22	33	comment
 | |
| 6	2004-01-01	1	test	22	33	comment
 | |
| 7	2004-01-01	1	test	22	33	comment
 | |
| drop table t1;
 | |
| CREATE TABLE `t1` ( `a` char(3) NOT NULL default '', `b` char(3) NOT NULL default '', `c` char(3) NOT NULL default '', PRIMARY KEY  (`a`,`b`,`c`)) ENGINE=InnoDB;
 | |
| CREATE TABLE t2 LIKE t1;
 | |
| INSERT INTO t1 VALUES (1,1,1);
 | |
| INSERT INTO t2 VALUES (1,1,1);
 | |
| PREPARE my_stmt FROM "SELECT t1.b, count(*) FROM t1 group by t1.b having
 | |
| count(*) > ALL (SELECT COUNT(*) FROM t2 WHERE t2.a=1 GROUP By t2.b)";
 | |
| EXECUTE my_stmt;
 | |
| b	count(*)
 | |
| EXECUTE my_stmt;
 | |
| b	count(*)
 | |
| deallocate prepare my_stmt;
 | |
| drop table t1,t2;
 | |
| CREATE TABLE t1 (
 | |
| school_name varchar(45) NOT NULL,
 | |
| country varchar(45) NOT NULL,    
 | |
| funds_requested float NOT NULL,
 | |
| schooltype varchar(45) NOT NULL
 | |
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 | |
| insert into t1 values ("the school", "USA", 1200, "Human");
 | |
| select count(country) as countrycount, sum(funds_requested) as smcnt,
 | |
| country, (select sum(funds_requested) from t1) as total_funds
 | |
| from t1
 | |
| group by country;
 | |
| countrycount	smcnt	country	total_funds
 | |
| 1	1200	USA	1200
 | |
| select count(country) as countrycount, sum(funds_requested) as smcnt,
 | |
| country, (select sum(funds_requested) from t1) as total_funds
 | |
| from t1
 | |
| group by country;
 | |
| countrycount	smcnt	country	total_funds
 | |
| 1	1200	USA	1200
 | |
| drop table t1;
 | |
| CREATE TABLE `t1` (
 | |
| `t3_id` int NOT NULL,
 | |
| `t1_id` int NOT NULL,
 | |
| PRIMARY KEY  (`t1_id`)
 | |
| );
 | |
| CREATE TABLE `t2` (
 | |
| `t2_id` int NOT NULL,
 | |
| `t1_id` int NOT NULL,
 | |
| `b` int NOT NULL,
 | |
| PRIMARY KEY  (`t2_id`),
 | |
| UNIQUE KEY `idx_t2_t1_b` (`t1_id`,`b`)
 | |
| ) ENGINE=InnoDB;
 | |
| CREATE TABLE `t3` (
 | |
| `t3_id` int NOT NULL
 | |
| );
 | |
| INSERT INTO `t3` VALUES (3);
 | |
| select
 | |
| (SELECT rs.t2_id
 | |
| FROM t2 rs
 | |
| WHERE rs.t1_id=
 | |
| (SELECT lt.t1_id
 | |
| FROM t1 lt
 | |
| WHERE lt.t3_id=a.t3_id)
 | |
| ORDER BY b DESC LIMIT 1)
 | |
| from t3 AS a;
 | |
| (SELECT rs.t2_id
 | |
| FROM t2 rs
 | |
| WHERE rs.t1_id=
 | |
| (SELECT lt.t1_id
 | |
| FROM t1 lt
 | |
| WHERE lt.t3_id=a.t3_id)
 | |
| ORDER BY b DESC LIMIT 1)
 | |
| NULL
 | |
| DROP PROCEDURE IF EXISTS p1;
 | |
| create procedure p1()
 | |
| begin
 | |
| declare done int default 3;
 | |
| repeat
 | |
| select
 | |
| (SELECT rs.t2_id
 | |
| FROM t2 rs
 | |
| WHERE rs.t1_id=
 | |
| (SELECT lt.t1_id
 | |
| FROM t1 lt
 | |
| WHERE lt.t3_id=a.t3_id)
 | |
| ORDER BY b DESC LIMIT 1) as x
 | |
| from t3 AS a;
 | |
| set done= done-1;
 | |
| until done <= 0 end repeat;
 | |
| end//
 | |
| call p1();
 | |
| x
 | |
| NULL
 | |
| x
 | |
| NULL
 | |
| x
 | |
| NULL
 | |
| call p1();
 | |
| x
 | |
| NULL
 | |
| x
 | |
| NULL
 | |
| x
 | |
| NULL
 | |
| call p1();
 | |
| x
 | |
| NULL
 | |
| x
 | |
| NULL
 | |
| x
 | |
| NULL
 | |
| drop procedure p1;
 | |
| drop tables t1,t2,t3;
 |