2011-07-08 16:46:47 +02:00
set @subselect_innodb_tmp=@@optimizer_switch;
set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
2003-11-02 13:43:11 +01:00
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 )
2003-12-10 05:31:42 +01:00
) ENGINE=InnoDB;
2003-11-02 13:43:11 +01:00
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;
2003-12-10 05:31:42 +01:00
create table t1 (a int) engine=innodb;
create table t2 (a int) engine=innodb;
create table t3 (a int) engine=innodb;
2003-11-02 13:43:11 +01:00
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)
2003-12-10 05:31:42 +01:00
) ENGINE=InnoDB;
2003-11-02 13:43:11 +01:00
CREATE TABLE t3 (
yod_id BIGINT UNSIGNED AUTO_INCREMENT NOT NULL,
login_processor INTEGER UNSIGNED ,
PRIMARY KEY (yod_id)
2003-12-10 05:31:42 +01:00
) ENGINE=InnoDB;
2003-11-02 13:43:11 +01:00
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)
2003-12-10 05:31:42 +01:00
) ENGINE=InnoDB;
2003-11-02 13:43:11 +01:00
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
2004-01-02 23:12:07 +01:00
2 2
3 3
After merge fixes
Added more DBUG statements
Ensure that we are comparing end space with BINARY strings
Use 'any_db' instead of '' to mean any database. (For HANDLER command)
Only strip ' ' when comparing CHAR, not other space-like characters (like \t)
BitKeeper/deleted/.del-ctype_tis620.result-old~3578ceb0b8284685:
Delete: mysql-test/r/ctype_tis620.result-old
BitKeeper/deleted/.del-ctype_tis620.test-old~ffb1bbd2935d1aba:
Delete: mysql-test/t/ctype_tis620.test-old
client/mysqlbinlog.cc:
Added DBUG statements
Added call of my_end() to free all used memory on exit
heap/hp_info.c:
After merge fixes
heap/hp_open.c:
After merge fixes
include/heap.h:
After merge fixes
include/m_ctype.h:
Use pchar instead of 'int' for character parameters.
Added 'my_binary_compare()'
include/m_string.h:
Fixed wrong define
innobase/ibuf/ibuf0ibuf.c:
After merge fixes
innobase/srv/srv0start.c:
After merge fixes
mysql-test/r/alter_table.result:
Fixed results after merge
mysql-test/r/auto_increment.result:
Fixed results after merge
mysql-test/r/bdb.result:
Fixed results after merge
mysql-test/r/binary.result:
Fixed results after merge
mysql-test/r/create.result:
Fixed results after merge
mysql-test/r/ctype_mb.result:
Fixed results after merge
mysql-test/r/ctype_tis620.result:
Fixed results after merge
mysql-test/r/ctype_utf8.result:
Fixed results after merge
mysql-test/r/delete.result:
Fixed results after merge
mysql-test/r/func_compress.result:
Fixed results after merge
mysql-test/r/func_gconcat.result:
Fixed results after merge
mysql-test/r/func_group.result:
Fixed results after merge
mysql-test/r/func_str.result:
Fixed results after merge
mysql-test/r/innodb.result:
Fixed results after merge
mysql-test/r/insert.result:
Fixed results after merge
mysql-test/r/insert_select.result:
Fixed results after merge
mysql-test/r/key.result:
Fixed results after merge
mysql-test/r/loaddata.result:
Fixed results after merge
mysql-test/r/lock.result:
Fixed results after merge
mysql-test/r/myisam.result:
Fixed results after merge
mysql-test/r/null.result:
Fixed results after merge
mysql-test/r/null_key.result:
Fixed results after merge
mysql-test/r/order_by.result:
Fixed results after merge
mysql-test/r/query_cache.result:
Fixed results after merge
mysql-test/r/range.result:
Fixed results after merge
mysql-test/r/rpl_multi_delete.result:
Fixed results after merge
mysql-test/r/rpl_until.result:
Fixed results after merge
mysql-test/r/subselect.result:
Fixed results after merge
mysql-test/r/subselect_innodb.result:
Fixed results after merge
mysql-test/r/type_blob.result:
Fixed results after merge
mysql-test/r/type_datetime.result:
Fixed results after merge
mysql-test/r/type_decimal.result:
Fixed results after merge
mysql-test/r/type_enum.result:
Fixed results after merge
mysql-test/r/type_float.result:
Fixed results after merge
mysql-test/r/type_ranges.result:
Fixed results after merge
mysql-test/r/type_time.result:
Fixed results after merge
mysql-test/r/type_timestamp.result:
Fixed results after merge
mysql-test/r/type_uint.result:
Fixed results after merge
mysql-test/r/type_year.result:
Fixed results after merge
mysql-test/r/variables.result:
Fixed results after merge
mysql-test/r/warnings.result:
Fixed results after merge
mysql-test/t/case.test:
Fixed shifted error messages
mysql-test/t/create.test:
Fixed shifted error messages
mysql-test/t/ctype_collate.test:
Fixed shifted error messages
mysql-test/t/ctype_tis620.test:
Merge with 4.0 ctype_tis620 test
mysql-test/t/delete.test:
Fixed shifted error messages
mysql-test/t/derived.test:
Fixed shifted error messages
mysql-test/t/fulltext.test:
Fixed shifted error messages
mysql-test/t/func_in.test:
Fixed shifted error messages
mysql-test/t/func_str.test:
Fixed shifted error messages
mysql-test/t/func_test.test:
Fixed shifted error messages
mysql-test/t/grant.test:
Fixed shifted error messages
mysql-test/t/innodb.test:
Change to 4.1 syntax
mysql-test/t/key_cache.test:
Fixed shifted error messages
mysql-test/t/myisam.test:
New test of blob and end space
mysql-test/t/row.test:
Fixed shifted error messages
mysql-test/t/rpl_until.test:
Fixed shifted error messages
mysql-test/t/subselect.test:
Fixed shifted error messages
mysql-test/t/subselect_innodb.test:
Fix test to take into account foreign key constraints
mysql-test/t/union.test:
Fixed shifted error messages
mysql-test/t/user_var.test:
Fixed shifted error messages
mysql-test/t/variables.test:
Fixed shifted error messages
mysys/my_handler.c:
Merge with 4.0 code
sql/ha_heap.cc:
After merge fixes
sql/handler.cc:
After merge fixes
sql/item.cc:
After merge fixes
sql/item_cmpfunc.cc:
Ensure that we are comparing end space with BINARY strings
sql/item_cmpfunc.h:
Ensure that we are comparing end space with BINARY strings
sql/log_event.cc:
More DBUG statements
Ensure that we use all options to LOAD DATA in replication
sql/opt_range.cc:
After merge fixes
sql/sql_db.cc:
After merge fixes
sql/sql_handler.cc:
After merge fixes
Use 'any_db' instead of '' to mean 'no database comparison'
sql/sql_parse.cc:
After merge fixes
sql/sql_select.cc:
After merge fixes
Added function comment for setup_group()
sql/sql_string.cc:
Added stringcmp() for binary comparison.
Added function comments for sortcmp() and stringcmp()
sql/sql_string.h:
Added stringcmp()
sql/sql_table.cc:
After merge fixes
sql/sql_update.cc:
After merge fixes
sql/sql_yacc.yy:
Use 'any_db' instead of '' to mean any database. Using "" causes a 'wrong db name' error.
strings/ctype-big5.c:
Strip only end space, not other space characters.
strings/ctype-bin.c:
Removed some not needed functions.
Added function comments
Don't remove end space in comparisons
Change my_wildcmp_bin() to be 'identical' with other similar code
strings/ctype-czech.c:
Strip only end space, not other space characters.
strings/ctype-gbk.c:
Strip only end space, not other space characters.
strings/ctype-latin1.c:
Strip only end space, not other space characters.
strings/ctype-mb.c:
Strip only end space, not other space characters.
strings/ctype-simple.c:
Strip only end space, not other space characters.
strings/ctype-sjis.c:
Strip only end space, not other space characters.
strings/ctype-tis620.c:
Added usage of my_instr_simple. This needs to be cleaned up!
strings/ctype-utf8.c:
Strip only end space, not other space characters.
strings/ctype-win1250ch.c:
Strip only end space, not other space characters.
Fixed indentation
strings/strto.c:
Code cleanup
2004-02-16 09:03:25 +01:00
drop table t2,t1,t3;
2003-12-10 21:46:14 +01:00
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)
2004-01-17 12:00:46 +01:00
) ENGINE=innodb DEFAULT CHARSET=latin1;
2003-12-10 21:46:14 +01:00
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)
2004-01-17 12:00:46 +01:00
) ENGINE=innodb DEFAULT CHARSET=latin1;
2003-12-10 21:46:14 +01:00
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;
2004-01-02 23:12:07 +01:00
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;
2004-06-09 22:32:20 +02:00
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;
2004-09-08 20:54:01 +02:00
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;
2004-12-03 23:14:18 +01:00
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;
2005-02-06 12:06:12 +01:00
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;
2005-10-13 09:53:00 +02:00
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;
2005-11-04 12:16:46 +01:00
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
Add new option "check-testcases" to mysql-test-run.pl
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''
2006-01-26 17:54:34 +01:00
drop procedure p1;
2005-11-04 12:16:46 +01:00
drop tables t1,t2,t3;
2011-02-17 13:41:25 +01:00
#
2012-09-01 23:21:59 +02:00
# Bug #58756
# Crash in heap_rrnd on query with HAVING ... IN (subquery) + LIMIT
#
CREATE TABLE t1 (
col_time_key time DEFAULT NULL,
col_datetime_key datetime DEFAULT NULL,
col_varchar_nokey varchar(1) DEFAULT NULL,
KEY col_time_key (col_time_key),
KEY col_datetime_key (col_datetime_key)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO t1 VALUES ('17:53:30','2005-11-10 12:40:29','h');
INSERT INTO t1 VALUES ('11:35:49','2009-04-25 00:00:00','b');
INSERT INTO t1 VALUES (NULL,'2002-11-27 00:00:00','s');
INSERT INTO t1 VALUES ('06:01:40','2004-01-26 20:32:32','e');
INSERT INTO t1 VALUES ('05:45:11','2007-10-26 11:41:40','j');
INSERT INTO t1 VALUES ('00:00:00','2005-10-07 00:00:00','e');
INSERT INTO t1 VALUES ('00:00:00','2000-07-15 05:00:34','f');
INSERT INTO t1 VALUES ('06:11:01','2000-04-03 16:33:32','v');
INSERT INTO t1 VALUES ('13:02:46',NULL,'x');
INSERT INTO t1 VALUES ('21:44:25','2001-04-25 01:26:12','m');
INSERT INTO t1 VALUES ('22:43:58','2000-12-27 00:00:00','c');
CREATE TABLE t2 (
col_time_key time DEFAULT NULL,
col_datetime_key datetime DEFAULT NULL,
col_varchar_nokey varchar(1) DEFAULT NULL,
KEY col_time_key (col_time_key),
KEY col_datetime_key (col_datetime_key)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO t2 VALUES ('11:28:45','2004-10-11 18:13:16','w');
SELECT col_time_key, col_datetime_key
FROM
( SELECT * FROM t1 ) AS table1
HAVING ( 'r' , 'e' ) IN
( SELECT col_varchar_nokey , col_varchar_nokey FROM t2 )
ORDER BY col_datetime_key
LIMIT 10;
col_time_key col_datetime_key
DROP TABLE t1;
DROP TABLE t2;
# End of Bug #58756
#
2011-02-17 13:41:25 +01:00
# Bug#60085 crash in Item::save_in_field() with time data type
#
CREATE TABLE t1(a date, b int, unique(b), unique(a), key(b)) engine=innodb;
INSERT INTO t1 VALUES ('2011-05-13', 0);
SELECT * FROM t1 WHERE b < (SELECT CAST(a as date) FROM t1 GROUP BY a);
a b
2011-05-13 0
DROP TABLE t1;
2011-11-22 18:04:38 +01:00
#
2012-04-04 11:29:45 +02:00
# Bug #11766300 59387: FAILING ASSERTION: CURSOR->POS_STATE == 1997660512 (BTR_PCUR_IS_POSITIONE
#
CREATE TABLE t1 (a INT) ENGINE=INNODB;
INSERT INTO t1 VALUES (0);
CREATE TABLE t2 (d BINARY(2), PRIMARY KEY (d(1)), UNIQUE KEY (d)) ENGINE=INNODB;
SELECT 1 FROM t1 WHERE NOT EXISTS
(SELECT 1 FROM t2 WHERE d = (SELECT d FROM t2 WHERE a >= 1) ORDER BY d);
1
1
EXPLAIN SELECT 1 FROM t1 WHERE NOT EXISTS
(SELECT 1 FROM t2 WHERE d = (SELECT d FROM t2 WHERE a >= 1) ORDER BY d);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 1 Using where
2019-05-10 11:47:44 +02:00
2 DEPENDENT SUBQUERY t2 unique_subquery PRIMARY,d PRIMARY 1 func 1 Using where
2017-04-04 19:04:52 +02:00
3 DEPENDENT SUBQUERY t2 index NULL d 2 NULL 1 Using index
2012-04-04 11:29:45 +02:00
DROP TABLE t2;
CREATE TABLE t2 (b INT, c INT, UNIQUE KEY (b), UNIQUE KEY (b, c )) ENGINE=INNODB;
INSERT INTO t2 VALUES (1, 1);
SELECT 1 FROM t1
WHERE a != (SELECT 1 FROM t2 WHERE a <=> b OR a > '' AND 6 = 7 ORDER BY b, c);
1
DROP TABLE t1, t2;
#
# Bug #13639204 64111: CRASH ON SELECT SUBQUERY WITH NON UNIQUE
# INDEX
#
CREATE TABLE t1 (
id int
) ENGINE=InnoDB;
INSERT INTO t1 (id) VALUES (11);
CREATE TABLE t2 (
t1_id int,
position int,
KEY t1_id (t1_id),
KEY t1_id_position (t1_id,position)
) ENGINE=InnoDB;
EXPLAIN SELECT
(SELECT position FROM t2
WHERE t2.t1_id = t1.id
ORDER BY t2.t1_id , t2.position
LIMIT 10,1
) AS maxkey
FROM t1
LIMIT 1;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 1
2012-05-21 15:30:25 +02:00
2 DEPENDENT SUBQUERY t2 ref t1_id,t1_id_position t1_id_position 5 test.t1.id 1 Using where; Using index
2012-04-04 11:29:45 +02:00
SELECT
(SELECT position FROM t2
WHERE t2.t1_id = t1.id
ORDER BY t2.t1_id , t2.position
LIMIT 10,1
) AS maxkey
FROM t1
LIMIT 1;
maxkey
NULL
DROP TABLE t1,t2;
End of 5.1 tests
2012-05-21 15:30:25 +02:00
#
2011-11-22 18:04:38 +01:00
# lp:827416 Crash in select_describe() on EXPLAIN with DISTINCT in nested subqueries
2011-08-26 23:40:29 +02:00
#
CREATE TABLE t3 ( b int) ENGINE=InnoDB;
CREATE TABLE t2 ( c int) ENGINE=InnoDB;
CREATE TABLE t1 ( a int NOT NULL , PRIMARY KEY (a)) ENGINE=InnoDB;
EXPLAIN SELECT *
FROM t1
WHERE t1.a = (
SELECT SUM( c )
FROM t2
WHERE (SELECT DISTINCT b FROM t3) > 0);
id select_type table type possible_keys key key_len ref rows Extra
2013-03-29 16:53:21 +01:00
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2012-05-17 12:46:05 +02:00
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2012-08-21 14:24:43 +02:00
3 SUBQUERY t3 ALL NULL NULL NULL NULL 1 Using temporary
2011-08-26 23:40:29 +02:00
SELECT *
FROM t1
WHERE t1.a = (
SELECT SUM( c )
FROM t2
WHERE (SELECT DISTINCT b FROM t3) > 0);
a
DROP TABLE t1, t2, t3;
2011-09-28 16:20:43 +02:00
#
2011-11-22 18:04:38 +01:00
# lp:858148 Fourth crash in select_describe() with nested subqueries
2011-09-28 16:20:43 +02:00
#
CREATE TABLE t1 ( f1 int(11)) ENGINE=InnoDB;
CREATE TABLE t2 ( f1 int(11), f2 int(11), PRIMARY KEY (f1)) ;
CREATE TABLE t3 ( f3 int(11)) ENGINE=InnoDB;
EXPLAIN
SELECT MAX( f1 ) FROM t2
WHERE f2 >= (
SELECT SUM( f1 )
FROM t1
WHERE EXISTS (
SELECT f3
FROM t3
GROUP BY 1
)
);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2012-05-17 12:46:05 +02:00
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2011-12-19 22:05:44 +01:00
3 SUBQUERY t3 ALL NULL NULL NULL NULL 1
2011-09-28 16:20:43 +02:00
SELECT MAX( f1 ) FROM t2
WHERE f2 >= (
SELECT SUM( f1 )
FROM t1
WHERE EXISTS (
SELECT f3
FROM t3
GROUP BY 1
)
);
MAX( f1 )
NULL
drop table t1, t2, t3;
2012-05-30 18:10:18 +02:00
#
# LP BUG#1006231 crash in select_describe
#
create table t1(a1 int) ENGINE=InnoDB;
insert into t1 values (1);
explain
select 1 from t1 where 1 like (select 1 from t1 where 1 <=> (select 1 from t1 group by a1));
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 1
2 SUBQUERY t1 ALL NULL NULL NULL NULL 1
2012-08-21 14:24:43 +02:00
3 SUBQUERY t1 ALL NULL NULL NULL NULL 1 Using temporary; Using filesort
2012-05-30 18:10:18 +02:00
select 1 from t1 where 1 like (select 1 from t1 where 1 <=> (select 1 from t1 group by a1));
1
1
drop table t1;
2013-01-16 14:11:13 +01:00
#
# MDEV-3988 crash in create_tmp_table
#
drop table if exists `t1`,`t2`;
Warnings:
2013-07-03 18:02:48 +02:00
Note 1051 Unknown table 'test.t1'
Note 1051 Unknown table 'test.t2'
2013-01-16 14:11:13 +01:00
create table `t1`(`a` char(1) character set utf8)engine=innodb;
create table `t2`(`b` char(1) character set utf8)engine=memory;
select distinct (select 1 from `t2` where `a`) `d2` from `t1`;
d2
select distinct (select 1 from `t2` where `a`) `d2`, a from `t1`;
d2 a
select distinct a, (select 1 from `t2` where `a`) `d2` from `t1`;
a d2
select distinct (1 + (select 1 from `t2` where `a`)) `d2` from `t1`;
d2
drop table t1,t2;
2013-07-11 17:27:39 +02:00
#
# MDEV-4042: Assertion `table->key_read == 0' fails in close_thread_table on EXPLAIN with GROUP BY and HAVING in EXISTS SQ,
# MDEV-4536: ...sql/sql_base.cc:1598: bool close_thread_table(THD*, TABLE**): Assertion `table->key_read == 0' failed.
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
CREATE TABLE t2 (b INT PRIMARY KEY, c INT) ENGINE=InnoDB;
CREATE TABLE t3 (d INT) ENGINE=InnoDB;
EXPLAIN
SELECT * FROM t1 WHERE EXISTS ( SELECT b FROM t2, t3 GROUP BY b HAVING b != 3 );
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2019-05-04 20:33:39 +02:00
2 SUBQUERY t2 index PRIMARY PRIMARY 4 NULL 1 Using where; Using index; Using temporary
2013-07-11 17:27:39 +02:00
2 SUBQUERY t3 ALL NULL NULL NULL NULL 1 Using join buffer (flat, BNL join)
SELECT * FROM t1 WHERE EXISTS ( SELECT b FROM t2, t3 GROUP BY b HAVING b != 3 );
a
DROP TABLE t1,t2,t3;
CREATE TABLE t1 (
pk int auto_increment primary key,
col_int_key int(11),
key col_int_key (col_int_key),col_varchar_key varchar(128),
key (col_varchar_key)
) engine=innodb;
EXPLAIN
SELECT 1 FROM t1 AS alias1
WHERE EXISTS ( SELECT SQ2_alias1 . col_int_key AS SQ2_field1
FROM ( t1 AS SQ2_alias1 RIGHT OUTER JOIN
t1 AS SQ2_alias2 ON (SQ2_alias2 . col_int_key = SQ2_alias1 . col_int_key )
)
GROUP BY SQ2_field1
HAVING SQ2_alias1 . col_int_key >= 7
);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2019-05-04 20:33:39 +02:00
2 SUBQUERY SQ2_alias2 index NULL col_int_key 5 NULL 1 Using index; Using temporary
2013-07-11 17:27:39 +02:00
2 SUBQUERY SQ2_alias1 ref col_int_key col_int_key 5 test.SQ2_alias2.col_int_key 1 Using where; Using index
SELECT 1 FROM t1 AS alias1
WHERE EXISTS ( SELECT SQ2_alias1 . col_int_key AS SQ2_field1
FROM ( t1 AS SQ2_alias1 RIGHT OUTER JOIN
t1 AS SQ2_alias2 ON (SQ2_alias2 . col_int_key = SQ2_alias1 . col_int_key )
)
GROUP BY SQ2_field1
HAVING SQ2_alias1 . col_int_key >= 7
);
1
drop table t1;
2011-07-08 16:46:47 +02:00
set optimizer_switch=@subselect_innodb_tmp;
2014-04-07 11:49:48 +02:00
#
2017-02-28 17:39:28 +01:00
# MDEV-9635:Server crashes in part_of_refkey or assertion
# `!created && key_to_save < (int)s->keys' failed in
# TABLE::use_index(int) or with join_cache_level>2
#
SET join_cache_level=3;
CREATE TABLE t1 (f1 VARCHAR(1024)) ENGINE=InnoDB;
CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1;
CREATE TABLE t2 (f2 VARCHAR(4)) ENGINE=InnoDB;
INSERT INTO t2 VALUES ('foo'),('bar');
SELECT * FROM v1, t2 WHERE ( f1, f2 ) IN ( SELECT f1, f1 FROM t1 );
f1 f2
set join_cache_level = default;
drop view v1;
drop table t1,t2;
2017-03-08 10:40:43 +01:00
#
2017-04-22 19:30:55 +02:00
# MDEV-10693: cost-based choice between materialization and in-to-exists
# for a subquery from the expression used in ref access
#
CREATE TABLE t1 (i1 INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (i2 INT) ENGINE=InnoDB;
CREATE TABLE t3 (i3 INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t3 VALUES (3);
SELECT * FROM t1
WHERE NULL IN ( SELECT i2 FROM t2
WHERE i1 IN ( i2 IN ( SELECT i3 FROM t3 ) ) AND i2 = 2 );
i1
DROP TABLE t1,t2,t3;
2017-04-25 16:30:39 +02:00
#
2014-04-07 11:49:48 +02:00
# MDEV-6041: ORDER BY+subqueries: subquery_table.key=outer_table.col is not recongized as binding
#
create table t1(a int) engine=innodb;
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t2(
id int primary key,
key1 int,
col1 int,
key(key1)
) engine=innodb;
insert into t2
select
A.a + B.a*10 + C.a*100 + D.a* 1000,
A.a + 10*B.a,
123456
from t1 A, t1 B, t1 C, t1 D;
# Table tsubq:
# - must use 'ref' (not 'index'), and must not use 'Using filesort'
# - shows a bad estimate for 'rows' (but I'm not sure if one can do better w/o histograms)
explain select
(SELECT
concat(id, '-', key1, '-', col1)
FROM t2
WHERE t2.key1 = t1.a
ORDER BY t2.id ASC LIMIT 1)
from
t1;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 10
2 DEPENDENT SUBQUERY t2 ref key1 key1 5 test.t1.a 1 Using where
2014-04-11 23:01:32 +02:00
#
# MDEV-6081: ORDER BY+ref(const): selectivity is very incorrect (MySQL Bug#14338686)
#
alter table t2 add key2 int;
update t2 set key2=key1;
alter table t2 add key(key2);
analyze table t2;
Table Op Msg_type Msg_text
2018-05-31 12:21:59 +02:00
test.t2 analyze status Engine-independent statistics collected
2014-04-11 23:01:32 +02:00
test.t2 analyze status OK
flush tables;
# Table tsubq must use 'ref' + Using filesort (not 'index' w/o filesort)
explain select
(SELECT
concat(id, '-', key1, '-', col1)
FROM t2
WHERE t2.key1 = t1.a
ORDER BY t2.key2 ASC LIMIT 1)
from
t1;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL #
2 DEPENDENT SUBQUERY t2 ref key1 key1 5 test.t1.a # Using where; Using filesort
drop table t1,t2;
2017-05-29 09:27:14 +02:00
#
# mdev-12931: semi-join in ON expression of STRAIGHT_JOIN
# joining a base table and a mergeable derived table
#
CREATE TABLE t1 (f1 int) ENGINE=InnoDB;
INSERT INTO t1 VALUES (3),(2);
CREATE TABLE t2 (f2 int) ENGINE=InnoDB;
INSERT INTO t2 VALUES (1),(4);
CREATE TABLE t3 (f3 int) ENGINE=InnoDB;
INSERT INTO t3 VALUES (5),(6);
CREATE TABLE t4 (f4 int) ENGINE=InnoDB;
INSERT INTO t4 VALUES (1),(8);
SELECT *
FROM t1
INNER JOIN
( t2 STRAIGHT_JOIN ( SELECT * FROM t3 ) AS sq
ON ( 1 IN ( SELECT f4 FROM t4 ) ) )
ON ( f1 >= f2 );
f1 f2 f3
3 1 5
2 1 5
3 1 6
2 1 6
EXPLAIN EXTENDED
SELECT *
FROM t1
INNER JOIN
( t2 STRAIGHT_JOIN ( SELECT * FROM t3 ) AS sq
ON ( 1 IN ( SELECT f4 FROM t4 ) ) )
ON ( f1 >= f2 );
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 4 func 1 100.00
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join)
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join)
1 PRIMARY t3 ALL NULL NULL NULL NULL 2 100.00 Using join buffer (incremental, BNL join)
3 MATERIALIZED t4 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
2017-06-08 11:45:08 +02:00
Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t2`.`f2` AS `f2`,`test`.`t3`.`f3` AS `f3` from `test`.`t1` join `test`.`t2` semi join (`test`.`t4`) join `test`.`t3` where `test`.`t4`.`f4` = 1 and `test`.`t1`.`f1` >= `test`.`t2`.`f2`
2017-05-29 09:27:14 +02:00
DROP TABLE t1,t2,t3,t4;
2019-04-02 15:04:45 +02:00
#
# MDEV-17362: SIGSEGV in JOIN::optimize_inner or Assertion `fixed == 0'
# failed in Item_equal::fix_fields, server crashes after 2nd execution
# of PS
#
create table t1 (a int, b int);
create table t2 (x int, y int);
insert into t1 values (1,1),(2,2);
insert into t2 values (1,1),(2,2),(2,3);
# here we can see conditions pushdown (see HAVING):
prepare stmt from "
explain extended
SELECT * FROM t1
WHERE a = b
AND (a,b) IN (SELECT t2.x, COUNT(t2.y) FROM t2 WHERE 1=2 GROUP BY t2.x);";
execute stmt;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
Warnings:
Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from <materialize> (/* select#2 */ select `test`.`t2`.`x`,count(`test`.`t2`.`y`) from `test`.`t2` where 0 group by `test`.`t2`.`x` having `COUNT(t2.y)` = `test`.`t2`.`x`) join `test`.`t1` where 0
# here re-execution of the pushdown does not crash:
prepare stmt from "
SELECT * FROM t1
WHERE a = b
AND (a,b) IN (SELECT t2.x, COUNT(t2.y) FROM t2 WHERE 1=2 GROUP BY t2.x);";
execute stmt;
a b
execute stmt;
a b
execute stmt;
a b
drop table t1,t2;