mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Manually merged
configure.in: Auto merged client/mysqlbinlog.cc: Auto merged mysql-test/mysql-test-run.pl: Auto merged mysql-test/r/archive.result: Auto merged mysql-test/r/auto_increment.result: Auto merged mysql-test/r/cast.result: Auto merged mysql-test/r/ctype_utf8.result: Auto merged mysql-test/r/func_group.result: Auto merged mysql-test/r/func_str.result: Auto merged mysql-test/r/func_time.result: Auto merged mysql-test/r/multi_update.result: Auto merged mysql-test/r/ndb_lock.result: Auto merged mysql-test/r/replace.result: Auto merged mysql-test/r/union.result: Auto merged mysql-test/t/archive.test: Auto merged mysql-test/t/auto_increment.test: Auto merged mysql-test/t/delayed.test: Auto merged mysql-test/t/func_time.test: Auto merged mysql-test/t/multi_update.test: Auto merged mysql-test/t/ndb_lock.test: Auto merged mysql-test/t/select.test: Auto merged sql/field.cc: Auto merged sql/ha_ndbcluster.cc: Auto merged sql/item.h: Auto merged sql/item_cmpfunc.h: Auto merged sql/item_func.cc: Auto merged sql/item_strfunc.cc: Auto merged sql/item_timefunc.cc: Auto merged sql/opt_range.cc: Auto merged sql/opt_sum.cc: Auto merged sql/sql_base.cc: Auto merged sql/sql_class.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_insert.cc: Auto merged sql/sql_lex.cc: Auto merged sql/sql_lex.h: Auto merged sql/sql_parse.cc: Auto merged sql/sql_select.cc: Auto merged sql/sql_select.h: Auto merged sql/sql_yacc.yy: Auto merged sql/structs.h: Auto merged storage/archive/ha_archive.cc: Auto merged tests/mysql_client_test.c: Auto merged
This commit is contained in:
@ -125,6 +125,21 @@ show slave status;
|
||||
--error 1220
|
||||
show binlog events in 'slave-bin.000005' from 4;
|
||||
|
||||
#
|
||||
# Bug #6880: LAST_INSERT_ID() within a statement
|
||||
#
|
||||
|
||||
create table t1(a int auto_increment primary key, b int);
|
||||
insert into t1 values (NULL, 1);
|
||||
reset master;
|
||||
set insert_id=5;
|
||||
insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id());
|
||||
--replace_result $VERSION VERSION
|
||||
show binlog events;
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
# The table drops caused Cluster Replication wrapper to fail as event ID would never be the same.# Moving drops here.
|
||||
|
||||
DROP TABLE t1;
|
||||
|
@ -6254,6 +6254,7 @@ auto fld1 companynr fld3 fld4 fld5 fld6
|
||||
3 011402 37 Romans scholastics jarring
|
||||
4 011403 37 intercepted audiology tinily
|
||||
DELETE FROM t2;
|
||||
ERROR HY000: Table storage engine for 't2' doesn't have this option
|
||||
SELECT * FROM t2;
|
||||
auto fld1 companynr fld3 fld4 fld5 fld6
|
||||
1 000001 00 Omaha teethe neat
|
||||
@ -8685,6 +8686,7 @@ auto fld1 companynr fld3 fld4 fld5 fld6
|
||||
3 011402 37 Romans scholastics jarring
|
||||
4 011403 37 intercepted audiology tinily
|
||||
TRUNCATE TABLE t2;
|
||||
ERROR HY000: Table storage engine for 't2' doesn't have this option
|
||||
SELECT * FROM t2;
|
||||
auto fld1 companynr fld3 fld4 fld5 fld6
|
||||
1 000001 00 Omaha teethe neat
|
||||
|
@ -378,6 +378,28 @@ t1 CREATE TABLE `t1` (
|
||||
KEY `t1_name` (`t1_name`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=1003 DEFAULT CHARSET=latin1
|
||||
DROP TABLE `t1`;
|
||||
create table t1(a int not null auto_increment primary key);
|
||||
create table t2(a int not null auto_increment primary key, t1a int);
|
||||
insert into t1 values(NULL);
|
||||
insert into t2 values (NULL, LAST_INSERT_ID()), (NULL, LAST_INSERT_ID());
|
||||
insert into t1 values (NULL);
|
||||
insert into t2 values (NULL, LAST_INSERT_ID()), (NULL, LAST_INSERT_ID()),
|
||||
(NULL, LAST_INSERT_ID());
|
||||
insert into t1 values (NULL);
|
||||
insert into t2 values (NULL, LAST_INSERT_ID()), (NULL, LAST_INSERT_ID()),
|
||||
(NULL, LAST_INSERT_ID()), (NULL, LAST_INSERT_ID());
|
||||
select * from t2;
|
||||
a t1a
|
||||
1 1
|
||||
2 1
|
||||
3 2
|
||||
4 2
|
||||
5 2
|
||||
6 3
|
||||
7 3
|
||||
8 3
|
||||
9 3
|
||||
drop table t1, t2;
|
||||
End of 4.1 tests
|
||||
CREATE TABLE t1 ( `a` int(11) NOT NULL auto_increment, `b` int(11) default NULL,PRIMARY KEY (`a`),UNIQUE KEY `b` (`b`));
|
||||
insert into t1 (b) values (1);
|
||||
|
@ -1112,6 +1112,46 @@ check table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
drop table t1;
|
||||
SET NAMES utf8;
|
||||
CREATE TABLE t1 (id int PRIMARY KEY,
|
||||
a varchar(16) collate utf8_unicode_ci NOT NULL default '',
|
||||
b int,
|
||||
f varchar(128) default 'XXX',
|
||||
INDEX (a(4))
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
INSERT INTO t1(id, a, b) VALUES
|
||||
(1, 'cccc', 50), (2, 'cccc', 70), (3, 'cccc', 30),
|
||||
(4, 'cccc', 30), (5, 'cccc', 20), (6, 'bbbbbb', 40),
|
||||
(7, 'dddd', 30), (8, 'aaaa', 10), (9, 'aaaa', 50),
|
||||
(10, 'eeeee', 40), (11, 'bbbbbb', 60);
|
||||
SELECT id, a, b FROM t1;
|
||||
id a b
|
||||
1 cccc 50
|
||||
2 cccc 70
|
||||
3 cccc 30
|
||||
4 cccc 30
|
||||
5 cccc 20
|
||||
6 bbbbbb 40
|
||||
7 dddd 30
|
||||
8 aaaa 10
|
||||
9 aaaa 50
|
||||
10 eeeee 40
|
||||
11 bbbbbb 60
|
||||
SELECT id, a, b FROM t1 WHERE a BETWEEN 'aaaa' AND 'bbbbbb';
|
||||
id a b
|
||||
8 aaaa 10
|
||||
9 aaaa 50
|
||||
6 bbbbbb 40
|
||||
11 bbbbbb 60
|
||||
SELECT id, a FROM t1 WHERE a='bbbbbb';
|
||||
id a
|
||||
6 bbbbbb
|
||||
11 bbbbbb
|
||||
SELECT id, a FROM t1 WHERE a='bbbbbb' ORDER BY b;
|
||||
id a
|
||||
6 bbbbbb
|
||||
11 bbbbbb
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(id varchar(20) NOT NULL) DEFAULT CHARSET=utf8;
|
||||
INSERT INTO t1 VALUES ('xxx'), ('aa'), ('yyy'), ('aa');
|
||||
SELECT id FROM t1;
|
||||
|
@ -39,3 +39,33 @@ select * from t1;
|
||||
a
|
||||
1
|
||||
drop table t1;
|
||||
CREATE TABLE t1 ( a int(10) NOT NULL auto_increment, PRIMARY KEY (a));
|
||||
insert delayed into t1 values(null);
|
||||
insert into t1 values(null);
|
||||
insert into t1 values(null);
|
||||
insert delayed into t1 values(null);
|
||||
insert delayed into t1 values(null);
|
||||
insert delayed into t1 values(null);
|
||||
insert into t1 values(null);
|
||||
insert into t1 values(null);
|
||||
insert into t1 values(null);
|
||||
delete from t1 where a=6;
|
||||
insert delayed into t1 values(null);
|
||||
insert delayed into t1 values(null);
|
||||
insert delayed into t1 values(null);
|
||||
insert delayed into t1 values(null);
|
||||
select * from t1 order by a;
|
||||
a
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
11
|
||||
12
|
||||
13
|
||||
DROP TABLE t1;
|
||||
|
@ -68,3 +68,17 @@ select 'a' union select concat('a', -0.0000);
|
||||
a
|
||||
a
|
||||
a0.0000
|
||||
select concat((select x from (select 'a' as x) as t1 ),
|
||||
(select y from (select 'b' as y) as t2 )) from (select 1 union select 2 )
|
||||
as t3;
|
||||
concat((select x from (select 'a' as x) as t1 ),
|
||||
(select y from (select 'b' as y) as t2 ))
|
||||
ab
|
||||
ab
|
||||
create table t1(f1 varchar(6)) charset=utf8;
|
||||
insert into t1 values ("123456");
|
||||
select concat(f1, 2) a from t1 union select 'x' a from t1;
|
||||
a
|
||||
1234562
|
||||
x
|
||||
drop table t1;
|
||||
|
@ -821,6 +821,41 @@ SELECT MAX(id) FROM t1 WHERE id < 3 AND a=2 AND b=6;
|
||||
MAX(id)
|
||||
NULL
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (id int PRIMARY KEY, b char(3), INDEX(b));
|
||||
INSERT INTO t1 VALUES (1,'xx'), (2,'aa');
|
||||
SELECT * FROM t1;
|
||||
id b
|
||||
1 xx
|
||||
2 aa
|
||||
SELECT MAX(b) FROM t1 WHERE b < 'ppppp';
|
||||
MAX(b)
|
||||
aa
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
SELECT MAX(b) FROM t1 WHERE b < 'pp';
|
||||
MAX(b)
|
||||
aa
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (id int PRIMARY KEY, b char(16), INDEX(b(4)));
|
||||
INSERT INTO t1 VALUES (1, 'xxxxbbbb'), (2, 'xxxxaaaa');
|
||||
SELECT MAX(b) FROM t1;
|
||||
MAX(b)
|
||||
xxxxbbbb
|
||||
EXPLAIN SELECT MAX(b) FROM t1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (id int , b varchar(512), INDEX(b(250))) COLLATE latin1_bin;
|
||||
INSERT INTO t1 VALUES
|
||||
(1,CONCAT(REPEAT('_', 250), "qq")), (1,CONCAT(REPEAT('_', 250), "zz")),
|
||||
(1,CONCAT(REPEAT('_', 250), "aa")), (1,CONCAT(REPEAT('_', 250), "ff"));
|
||||
SELECT MAX(b) FROM t1;
|
||||
MAX(b)
|
||||
__________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________zz
|
||||
EXPLAIN SELECT MAX(b) FROM t1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 4
|
||||
DROP TABLE t1;
|
||||
create table t2 (ff double);
|
||||
insert into t2 values (2.2);
|
||||
select cast(sum(distinct ff) as decimal(5,2)) from t2;
|
||||
|
@ -202,6 +202,35 @@ select count(*) from t1 where id not in (1,2);
|
||||
count(*)
|
||||
1
|
||||
drop table t1;
|
||||
create table t1 (f1 char(1), f2 int);
|
||||
insert into t1 values (1,0),('a',1),('z',2);
|
||||
select f1 from t1 where f1 in (1,'z');
|
||||
f1
|
||||
1
|
||||
z
|
||||
select f2 from t1 where f2 in (1,'z');
|
||||
f2
|
||||
0
|
||||
1
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect INTEGER value: 'z'
|
||||
select f1 from t1 where 'z' in (1,f1);
|
||||
f1
|
||||
z
|
||||
select * from t1 where 'z' in (f2,f1);
|
||||
f1 f2
|
||||
1 0
|
||||
a 1
|
||||
z 2
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'z'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'z'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'z'
|
||||
select * from t1 where 1 in (f2,f1);
|
||||
f1 f2
|
||||
1 0
|
||||
a 1
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (a int PRIMARY KEY);
|
||||
INSERT INTO t1 VALUES (44), (45), (46);
|
||||
SELECT * FROM t1 WHERE a IN (45);
|
||||
|
@ -1023,6 +1023,21 @@ NULL
|
||||
select ifnull(load_file("lkjlkj"),"it's null");
|
||||
ifnull(load_file("lkjlkj"),"it's null")
|
||||
it's null
|
||||
create table t1 (f1 varchar(4), f2 varchar(64), unique key k1 (f1,f2));
|
||||
insert into t1 values ( 'test',md5('test')), ('test', sha('test'));
|
||||
select * from t1 where f1='test' and (f2= md5("test") or f2= md5("TEST"));
|
||||
f1 f2
|
||||
test 098f6bcd4621d373cade4e832627b4f6
|
||||
select * from t1 where f1='test' and (f2= md5("TEST") or f2= md5("test"));
|
||||
f1 f2
|
||||
test 098f6bcd4621d373cade4e832627b4f6
|
||||
select * from t1 where f1='test' and (f2= sha("test") or f2= sha("TEST"));
|
||||
f1 f2
|
||||
test a94a8fe5ccb19ba61c4c0873d391e987982fbbd3
|
||||
select * from t1 where f1='test' and (f2= sha("TEST") or f2= sha("test"));
|
||||
f1 f2
|
||||
test a94a8fe5ccb19ba61c4c0873d391e987982fbbd3
|
||||
drop table t1;
|
||||
End of 4.1 tests
|
||||
create table t1 (d decimal default null);
|
||||
insert into t1 values (null);
|
||||
|
@ -751,6 +751,49 @@ select monthname(str_to_date(null, '%m')), monthname(str_to_date(null, '%m')),
|
||||
monthname(str_to_date(1, '%m')), monthname(str_to_date(0, '%m'));
|
||||
monthname(str_to_date(null, '%m')) monthname(str_to_date(null, '%m')) monthname(str_to_date(1, '%m')) monthname(str_to_date(0, '%m'))
|
||||
NULL NULL January NULL
|
||||
create table t1(f1 date, f2 time, f3 datetime);
|
||||
insert into t1 values ("2006-01-01", "12:01:01", "2006-01-01 12:01:01");
|
||||
insert into t1 values ("2006-01-02", "12:01:02", "2006-01-02 12:01:02");
|
||||
select f1 from t1 where f1 between "2006-1-1" and 20060101;
|
||||
f1
|
||||
2006-01-01
|
||||
select f1 from t1 where f1 between "2006-1-1" and "2006.1.1";
|
||||
f1
|
||||
2006-01-01
|
||||
select f1 from t1 where date(f1) between "2006-1-1" and "2006.1.1";
|
||||
f1
|
||||
2006-01-01
|
||||
select f2 from t1 where f2 between "12:1:2" and "12:2:2";
|
||||
f2
|
||||
12:01:02
|
||||
select f2 from t1 where time(f2) between "12:1:2" and "12:2:2";
|
||||
f2
|
||||
12:01:02
|
||||
select f3 from t1 where f3 between "2006-1-1 12:1:1" and "2006-1-1 12:1:2";
|
||||
f3
|
||||
2006-01-01 12:01:01
|
||||
select f3 from t1 where timestamp(f3) between "2006-1-1 12:1:1" and "2006-1-1 12:1:2";
|
||||
f3
|
||||
2006-01-01 12:01:01
|
||||
select f1 from t1 where "2006-1-1" between f1 and f3;
|
||||
f1
|
||||
2006-01-01
|
||||
select f1 from t1 where "2006-1-1" between date(f1) and date(f3);
|
||||
f1
|
||||
2006-01-01
|
||||
select f1 from t1 where "2006-1-1" between f1 and 'zzz';
|
||||
f1
|
||||
Warnings:
|
||||
Warning 1292 Incorrect date value: 'zzz' for column 'f1' at row 1
|
||||
Warning 1292 Truncated incorrect INTEGER value: 'zzz'
|
||||
Warning 1292 Truncated incorrect INTEGER value: 'zzz'
|
||||
select f1 from t1 where makedate(2006,1) between date(f1) and date(f3);
|
||||
f1
|
||||
2006-01-01
|
||||
select f1 from t1 where makedate(2006,2) between date(f1) and date(f3);
|
||||
f1
|
||||
2006-01-02
|
||||
drop table t1;
|
||||
select now() - now() + 0, curtime() - curtime() + 0,
|
||||
sec_to_time(1) + 0, from_unixtime(1) + 0;
|
||||
now() - now() + 0 curtime() - curtime() + 0 sec_to_time(1) + 0 from_unixtime(1) + 0
|
||||
|
@ -744,3 +744,23 @@ select a2 from ((t1 natural join t2) join t3 on b=c1) natural join t4;
|
||||
a2
|
||||
1
|
||||
drop table t1,t2,t3,t4;
|
||||
create table t1 (c int, b int);
|
||||
create table t2 (a int, b int);
|
||||
create table t3 (b int, c int);
|
||||
create table t4 (y int, c int);
|
||||
create table t5 (y int, z int);
|
||||
insert into t1 values (3,2);
|
||||
insert into t2 values (1,2);
|
||||
insert into t3 values (2,3);
|
||||
insert into t4 values (1,3);
|
||||
insert into t5 values (1,4);
|
||||
prepare stmt1 from "select * from ((t3 natural join (t1 natural join t2))
|
||||
natural join t4) natural join t5";
|
||||
execute stmt1;
|
||||
y c b a z
|
||||
1 3 2 1 4
|
||||
select * from ((t3 natural join (t1 natural join t2)) natural join t4)
|
||||
natural join t5;
|
||||
y c b a z
|
||||
1 3 2 1 4
|
||||
drop table t1, t2, t3, t4, t5;
|
||||
|
@ -476,6 +476,11 @@ aclid bigint, index idx_acl(aclid)
|
||||
insert into t2 values(1,null);
|
||||
delete t2, t1 from t2 left join t1 on (t2.aclid=t1.aclid) where t2.refid='1';
|
||||
drop table t1, t2;
|
||||
create table t1(a int);
|
||||
create table t2(a int);
|
||||
delete from t1,t2 using t1,t2 where t1.a=(select a from t1);
|
||||
ERROR HY000: You can't specify target table 't1' for update in FROM clause
|
||||
drop table t1, t2;
|
||||
create table t1 ( c char(8) not null ) engine=innodb;
|
||||
insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9');
|
||||
insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F');
|
||||
|
@ -24,3 +24,9 @@ a b
|
||||
63 default_value
|
||||
127 last
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (f1 INT);
|
||||
CREATE VIEW v1 AS SELECT f1 FROM t1 WHERE f1 = 0 WITH CHECK OPTION;
|
||||
REPLACE INTO v1 (f1) VALUES (1);
|
||||
ERROR HY000: CHECK OPTION failed 'test.v1'
|
||||
DROP TABLE t1;
|
||||
DROP VIEW v1;
|
||||
|
@ -95,6 +95,23 @@ Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File
|
||||
# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 388 # # master-bin.000002 Yes Yes # 0 0 388 # None 0 No #
|
||||
show binlog events in 'slave-bin.000005' from 4;
|
||||
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
|
||||
create table t1(a int auto_increment primary key, b int);
|
||||
insert into t1 values (NULL, 1);
|
||||
reset master;
|
||||
set insert_id=5;
|
||||
insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id());
|
||||
show binlog events;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
slave-bin.000001 4 Format_desc 2 98 Server ver: VERSION, Binlog ver: 4
|
||||
slave-bin.000001 98 Intvar 2 126 LAST_INSERT_ID=1
|
||||
slave-bin.000001 126 Intvar 2 154 INSERT_ID=5
|
||||
slave-bin.000001 154 Query 2 289 use `test`; insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id())
|
||||
select * from t1;
|
||||
a b
|
||||
1 1
|
||||
5 1
|
||||
6 1
|
||||
drop table t1;
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t3;
|
||||
|
@ -2656,16 +2656,6 @@ t11 MyISAM 10 Dynamic 0 0 X X X X X X X X latin1_swedish_ci NULL
|
||||
select 123 as a from t1 where f1 is null;
|
||||
a
|
||||
drop table t1,t11;
|
||||
CREATE TABLE t1 (a INT, b INT);
|
||||
(SELECT a, b AS c FROM t1) ORDER BY c+1;
|
||||
a c
|
||||
(SELECT a, b AS c FROM t1) ORDER BY b+1;
|
||||
a c
|
||||
SELECT a, b AS c FROM t1 ORDER BY c+1;
|
||||
a c
|
||||
SELECT a, b AS c FROM t1 ORDER BY b+1;
|
||||
a c
|
||||
drop table t1;
|
||||
CREATE TABLE t1 ( a INT NOT NULL, b INT NOT NULL, UNIQUE idx (a,b) );
|
||||
INSERT INTO t1 VALUES (1,1),(1,2),(1,3),(1,4);
|
||||
CREATE TABLE t2 ( a INT NOT NULL, b INT NOT NULL, e INT );
|
||||
@ -2716,6 +2706,30 @@ select * from t1 where f1 in (select f3 from t2 where (f3,f4)= (select f3,f4 fro
|
||||
f1 f2
|
||||
1 1
|
||||
drop table t1,t2;
|
||||
CREATE TABLE t1(a int, b int, c int, KEY b(b), KEY c(c));
|
||||
insert into t1 values (1,0,0),(2,0,0);
|
||||
CREATE TABLE t2 (a int, b varchar(2), c varchar(2), PRIMARY KEY(a));
|
||||
insert into t2 values (1,'',''), (2,'','');
|
||||
CREATE TABLE t3 (a int, b int, PRIMARY KEY (a,b), KEY a (a), KEY b (b));
|
||||
insert into t3 values (1,1),(1,2);
|
||||
explain select straight_join DISTINCT t2.a,t2.b, t1.c from t1, t3, t2
|
||||
where (t1.c=t2.a or (t1.c=t3.a and t2.a=t3.b)) and t1.b=556476786 and
|
||||
t2.b like '%%' order by t2.b limit 0,1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref b,c b 5 const 1 Using where; Using temporary; Using filesort
|
||||
1 SIMPLE t3 index PRIMARY,a,b PRIMARY 8 NULL 2 Using index
|
||||
1 SIMPLE t2 ALL PRIMARY NULL NULL NULL 2 Range checked for each record (index map: 0x1)
|
||||
DROP TABLE t1,t2,t3;
|
||||
CREATE TABLE t1 (a int, INDEX idx(a));
|
||||
INSERT INTO t1 VALUES (2), (3), (1);
|
||||
EXPLAIN SELECT * FROM t1 IGNORE INDEX (idx);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
|
||||
EXPLAIN SELECT * FROM t1 IGNORE INDEX (a);
|
||||
ERROR HY000: Key 'a' doesn't exist in table 't1'
|
||||
EXPLAIN SELECT * FROM t1 FORCE INDEX (a);
|
||||
ERROR HY000: Key 'a' doesn't exist in table 't1'
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a int, INDEX idx(a));
|
||||
INSERT INTO t1 VALUES (2), (3), (1);
|
||||
EXPLAIN SELECT * FROM t1 IGNORE INDEX (idx);
|
||||
@ -2723,7 +2737,6 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
|
||||
EXPLAIN SELECT * FROM t1 IGNORE INDEX (a);
|
||||
ERROR 42000: Key 'a' doesn't exist in table 't1'
|
||||
EXPLAIN SELECT * FROM t1 FORCE INDEX (a);
|
||||
ERROR 42000: Key 'a' doesn't exist in table 't1'
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 ( city char(30) );
|
||||
@ -2814,19 +2827,6 @@ WART 0100 1
|
||||
WART 0200 1
|
||||
WART 0300 3
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 ( a BLOB, INDEX (a(20)) );
|
||||
CREATE TABLE t2 ( a BLOB, INDEX (a(20)) );
|
||||
INSERT INTO t1 VALUES ('one'),('two'),('three'),('four'),('five');
|
||||
INSERT INTO t2 VALUES ('one'),('two'),('three'),('four'),('five');
|
||||
EXPLAIN SELECT * FROM t1 LEFT JOIN t2 USE INDEX (a) ON t1.a=t2.a;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 5
|
||||
1 SIMPLE t2 ref a a 23 test.t1.a 2
|
||||
EXPLAIN SELECT * FROM t1 LEFT JOIN t2 FORCE INDEX (a) ON t1.a=t2.a;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 5
|
||||
1 SIMPLE t2 ref a a 23 test.t1.a 2
|
||||
DROP TABLE t1, t2;
|
||||
create table t1 (a int, b int);
|
||||
create table t2 like t1;
|
||||
select t1.a from (t1 inner join t2 on t1.a=t2.a) where t2.a=1;
|
||||
@ -2857,29 +2857,6 @@ x
|
||||
NULL
|
||||
1.0000
|
||||
drop table t1;
|
||||
create table t1 (a int(11));
|
||||
select all all * from t1;
|
||||
a
|
||||
select distinct distinct * from t1;
|
||||
a
|
||||
select all distinct * from t1;
|
||||
ERROR HY000: Incorrect usage of ALL and DISTINCT
|
||||
select distinct all * from t1;
|
||||
ERROR HY000: Incorrect usage of ALL and DISTINCT
|
||||
drop table t1;
|
||||
CREATE TABLE t1 ( a BLOB, INDEX (a(20)) );
|
||||
CREATE TABLE t2 ( a BLOB, INDEX (a(20)) );
|
||||
INSERT INTO t1 VALUES ('one'),('two'),('three'),('four'),('five');
|
||||
INSERT INTO t2 VALUES ('one'),('two'),('three'),('four'),('five');
|
||||
EXPLAIN SELECT * FROM t1 LEFT JOIN t2 USE INDEX (a) ON t1.a=t2.a;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 5
|
||||
1 SIMPLE t2 ref a a 23 test.t1.a 2
|
||||
EXPLAIN SELECT * FROM t1 LEFT JOIN t2 FORCE INDEX (a) ON t1.a=t2.a;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 5
|
||||
1 SIMPLE t2 ref a a 23 test.t1.a 2
|
||||
DROP TABLE t1, t2;
|
||||
CREATE TABLE t1 (a int);
|
||||
CREATE TABLE t2 (a int);
|
||||
INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
|
||||
@ -3456,3 +3433,23 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range PRIMARY,b b 5 NULL 3 Using where
|
||||
1 SIMPLE t2 ref c c 5 test.t1.a 2 Using where
|
||||
DROP TABLE t1, t2;
|
||||
create table t1 (
|
||||
a int unsigned not null auto_increment primary key,
|
||||
b bit not null,
|
||||
c bit not null
|
||||
);
|
||||
create table t2 (
|
||||
a int unsigned not null auto_increment primary key,
|
||||
b bit not null,
|
||||
c int unsigned not null,
|
||||
d varchar(50)
|
||||
);
|
||||
insert into t1 (b,c) values (0,1), (0,1);
|
||||
insert into t2 (b,c) values (0,1);
|
||||
select t1.a, t1.b + 0, t1.c + 0, t2.a, t2.b + 0, t2.c, t2.d
|
||||
from t1 left outer join t2 on t1.a = t2.c and t2.b <> 1
|
||||
where t1.b <> 1 order by t1.a;
|
||||
a t1.b + 0 t1.c + 0 a t2.b + 0 c d
|
||||
1 0 1 1 0 1 NULL
|
||||
2 0 1 NULL NULL NULL NULL
|
||||
drop table t1,t2;
|
||||
|
@ -1306,3 +1306,48 @@ id
|
||||
5
|
||||
99
|
||||
drop table t1;
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1));
|
||||
avg(1)
|
||||
NULL
|
||||
|
@ -1330,12 +1330,14 @@ SELECT * FROM t2;
|
||||
#
|
||||
# For bug #12836
|
||||
# Delete was allowing all rows to be removed
|
||||
--error 1031
|
||||
DELETE FROM t2;
|
||||
SELECT * FROM t2;
|
||||
INSERT INTO t2 VALUES (2,011401,37,'breaking','dreaded','Steinberg','W');
|
||||
INSERT INTO t2 VALUES (3,011402,37,'Romans','scholastics','jarring','');
|
||||
INSERT INTO t2 VALUES (4,011403,37,'intercepted','audiology','tinily','');
|
||||
SELECT * FROM t2;
|
||||
--error 1031
|
||||
TRUNCATE TABLE t2;
|
||||
SELECT * FROM t2;
|
||||
|
||||
|
@ -238,6 +238,23 @@ SHOW CREATE TABLE `t1`;
|
||||
|
||||
DROP TABLE `t1`;
|
||||
|
||||
#
|
||||
# Bug #6880: LAST_INSERT_ID() within a statement
|
||||
#
|
||||
|
||||
create table t1(a int not null auto_increment primary key);
|
||||
create table t2(a int not null auto_increment primary key, t1a int);
|
||||
insert into t1 values(NULL);
|
||||
insert into t2 values (NULL, LAST_INSERT_ID()), (NULL, LAST_INSERT_ID());
|
||||
insert into t1 values (NULL);
|
||||
insert into t2 values (NULL, LAST_INSERT_ID()), (NULL, LAST_INSERT_ID()),
|
||||
(NULL, LAST_INSERT_ID());
|
||||
insert into t1 values (NULL);
|
||||
insert into t2 values (NULL, LAST_INSERT_ID()), (NULL, LAST_INSERT_ID()),
|
||||
(NULL, LAST_INSERT_ID()), (NULL, LAST_INSERT_ID());
|
||||
select * from t2;
|
||||
drop table t1, t2;
|
||||
|
||||
--echo End of 4.1 tests
|
||||
|
||||
#
|
||||
|
@ -912,6 +912,32 @@ INSERT INTO t1 VALUES('uUABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
check table t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug#14896: Comparison with a key in a partial index over mb chararacter field
|
||||
#
|
||||
|
||||
SET NAMES utf8;
|
||||
CREATE TABLE t1 (id int PRIMARY KEY,
|
||||
a varchar(16) collate utf8_unicode_ci NOT NULL default '',
|
||||
b int,
|
||||
f varchar(128) default 'XXX',
|
||||
INDEX (a(4))
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
INSERT INTO t1(id, a, b) VALUES
|
||||
(1, 'cccc', 50), (2, 'cccc', 70), (3, 'cccc', 30),
|
||||
(4, 'cccc', 30), (5, 'cccc', 20), (6, 'bbbbbb', 40),
|
||||
(7, 'dddd', 30), (8, 'aaaa', 10), (9, 'aaaa', 50),
|
||||
(10, 'eeeee', 40), (11, 'bbbbbb', 60);
|
||||
|
||||
SELECT id, a, b FROM t1;
|
||||
|
||||
SELECT id, a, b FROM t1 WHERE a BETWEEN 'aaaa' AND 'bbbbbb';
|
||||
|
||||
SELECT id, a FROM t1 WHERE a='bbbbbb';
|
||||
SELECT id, a FROM t1 WHERE a='bbbbbb' ORDER BY b;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
|
@ -50,3 +50,52 @@ insert into t1 values (1);
|
||||
insert delayed into t1 values (1);
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #20195: INSERT DELAYED with auto_increment is assigned wrong values
|
||||
#
|
||||
CREATE TABLE t1 ( a int(10) NOT NULL auto_increment, PRIMARY KEY (a));
|
||||
|
||||
# Make one delayed insert to start the separate thread
|
||||
insert delayed into t1 values(null);
|
||||
|
||||
# Do some normal inserts
|
||||
insert into t1 values(null);
|
||||
insert into t1 values(null);
|
||||
|
||||
# Discarded, since the delayed-counter is 2, which is already used
|
||||
insert delayed into t1 values(null);
|
||||
|
||||
# Discarded, since the delayed-counter is 3, which is already used
|
||||
insert delayed into t1 values(null);
|
||||
|
||||
# Works, since the delayed-counter is 4, which is unused
|
||||
insert delayed into t1 values(null);
|
||||
|
||||
# Do some more inserts
|
||||
insert into t1 values(null);
|
||||
insert into t1 values(null);
|
||||
insert into t1 values(null);
|
||||
|
||||
# Delete one of the above to make a hole
|
||||
delete from t1 where a=6;
|
||||
|
||||
# Discarded, since the delayed-counter is 5, which is already used
|
||||
insert delayed into t1 values(null);
|
||||
|
||||
# Works, since the delayed-counter is 6, which is unused (the row we deleted)
|
||||
insert delayed into t1 values(null);
|
||||
|
||||
# Discarded, since the delayed-counter is 7, which is already used
|
||||
insert delayed into t1 values(null);
|
||||
|
||||
# Works, since the delayed-counter is 8, which is unused
|
||||
insert delayed into t1 values(null);
|
||||
|
||||
# Check what we have now
|
||||
# must wait so that the delayed thread finishes
|
||||
# Note: this must be increased if the test fails
|
||||
--sleep 1
|
||||
select * from t1 order by a;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
@ -52,4 +52,19 @@ select 'a' union select concat('a', -0.0);
|
||||
--replace_result a-0.0000 a0.0000
|
||||
select 'a' union select concat('a', -0.0000);
|
||||
|
||||
#
|
||||
# Bug#16716: subselect in concat() may lead to a wrong result
|
||||
#
|
||||
select concat((select x from (select 'a' as x) as t1 ),
|
||||
(select y from (select 'b' as y) as t2 )) from (select 1 union select 2 )
|
||||
as t3;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
# Bug#15962: CONCAT() in UNION may lead to a data trucation.
|
||||
#
|
||||
create table t1(f1 varchar(6)) charset=utf8;
|
||||
insert into t1 values ("123456");
|
||||
select concat(f1, 2) a from t1 union select 'x' a from t1;
|
||||
drop table t1;
|
||||
|
@ -539,6 +539,34 @@ INSERT INTO t1 VALUES
|
||||
SELECT MAX(id) FROM t1 WHERE id < 3 AND a=2 AND b=6;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug #18206: min/max optimization cannot be applied to partial index
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (id int PRIMARY KEY, b char(3), INDEX(b));
|
||||
INSERT INTO t1 VALUES (1,'xx'), (2,'aa');
|
||||
SELECT * FROM t1;
|
||||
|
||||
SELECT MAX(b) FROM t1 WHERE b < 'ppppp';
|
||||
SHOW WARNINGS;
|
||||
SELECT MAX(b) FROM t1 WHERE b < 'pp';
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (id int PRIMARY KEY, b char(16), INDEX(b(4)));
|
||||
INSERT INTO t1 VALUES (1, 'xxxxbbbb'), (2, 'xxxxaaaa');
|
||||
SELECT MAX(b) FROM t1;
|
||||
EXPLAIN SELECT MAX(b) FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (id int , b varchar(512), INDEX(b(250))) COLLATE latin1_bin;
|
||||
INSERT INTO t1 VALUES
|
||||
(1,CONCAT(REPEAT('_', 250), "qq")), (1,CONCAT(REPEAT('_', 250), "zz")),
|
||||
(1,CONCAT(REPEAT('_', 250), "aa")), (1,CONCAT(REPEAT('_', 250), "ff"));
|
||||
|
||||
SELECT MAX(b) FROM t1;
|
||||
EXPLAIN SELECT MAX(b) FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
|
@ -109,6 +109,18 @@ select count(*) from t1 where id not in (1);
|
||||
select count(*) from t1 where id not in (1,2);
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug#18360 Incorrect type coercion in IN() results in false comparison
|
||||
#
|
||||
create table t1 (f1 char(1), f2 int);
|
||||
insert into t1 values (1,0),('a',1),('z',2);
|
||||
select f1 from t1 where f1 in (1,'z');
|
||||
select f2 from t1 where f2 in (1,'z');
|
||||
select f1 from t1 where 'z' in (1,f1);
|
||||
select * from t1 where 'z' in (f2,f1);
|
||||
select * from t1 where 1 in (f2,f1);
|
||||
drop table t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
|
@ -673,6 +673,18 @@ drop table t1;
|
||||
select load_file("lkjlkj");
|
||||
select ifnull(load_file("lkjlkj"),"it's null");
|
||||
|
||||
#
|
||||
# Bug#15351: Wrong collation used for comparison of md5() and sha()
|
||||
# parameter can lead to a wrong result.
|
||||
#
|
||||
create table t1 (f1 varchar(4), f2 varchar(64), unique key k1 (f1,f2));
|
||||
insert into t1 values ( 'test',md5('test')), ('test', sha('test'));
|
||||
select * from t1 where f1='test' and (f2= md5("test") or f2= md5("TEST"));
|
||||
select * from t1 where f1='test' and (f2= md5("TEST") or f2= md5("test"));
|
||||
select * from t1 where f1='test' and (f2= sha("test") or f2= sha("TEST"));
|
||||
select * from t1 where f1='test' and (f2= sha("TEST") or f2= sha("test"));
|
||||
drop table t1;
|
||||
|
||||
--echo End of 4.1 tests
|
||||
|
||||
#
|
||||
|
@ -367,6 +367,27 @@ select last_day('2005-01-00');
|
||||
select monthname(str_to_date(null, '%m')), monthname(str_to_date(null, '%m')),
|
||||
monthname(str_to_date(1, '%m')), monthname(str_to_date(0, '%m'));
|
||||
|
||||
#
|
||||
# Bug#16377 result of DATE/TIME functions were compared as strings which
|
||||
# can lead to a wrong result.
|
||||
#
|
||||
create table t1(f1 date, f2 time, f3 datetime);
|
||||
insert into t1 values ("2006-01-01", "12:01:01", "2006-01-01 12:01:01");
|
||||
insert into t1 values ("2006-01-02", "12:01:02", "2006-01-02 12:01:02");
|
||||
select f1 from t1 where f1 between "2006-1-1" and 20060101;
|
||||
select f1 from t1 where f1 between "2006-1-1" and "2006.1.1";
|
||||
select f1 from t1 where date(f1) between "2006-1-1" and "2006.1.1";
|
||||
select f2 from t1 where f2 between "12:1:2" and "12:2:2";
|
||||
select f2 from t1 where time(f2) between "12:1:2" and "12:2:2";
|
||||
select f3 from t1 where f3 between "2006-1-1 12:1:1" and "2006-1-1 12:1:2";
|
||||
select f3 from t1 where timestamp(f3) between "2006-1-1 12:1:1" and "2006-1-1 12:1:2";
|
||||
select f1 from t1 where "2006-1-1" between f1 and f3;
|
||||
select f1 from t1 where "2006-1-1" between date(f1) and date(f3);
|
||||
select f1 from t1 where "2006-1-1" between f1 and 'zzz';
|
||||
select f1 from t1 where makedate(2006,1) between date(f1) and date(f3);
|
||||
select f1 from t1 where makedate(2006,2) between date(f1) and date(f3);
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #16546
|
||||
#
|
||||
|
@ -563,4 +563,29 @@ select a2 from ((t1 natural join t2) join t3 on b=c1) natural join t4;
|
||||
|
||||
drop table t1,t2,t3,t4;
|
||||
|
||||
#
|
||||
# BUG#15355: Common natural join column not resolved in prepared statement nested query
|
||||
#
|
||||
create table t1 (c int, b int);
|
||||
create table t2 (a int, b int);
|
||||
create table t3 (b int, c int);
|
||||
create table t4 (y int, c int);
|
||||
create table t5 (y int, z int);
|
||||
|
||||
insert into t1 values (3,2);
|
||||
insert into t2 values (1,2);
|
||||
insert into t3 values (2,3);
|
||||
insert into t4 values (1,3);
|
||||
insert into t5 values (1,4);
|
||||
|
||||
-- this fails
|
||||
prepare stmt1 from "select * from ((t3 natural join (t1 natural join t2))
|
||||
natural join t4) natural join t5";
|
||||
execute stmt1;
|
||||
|
||||
-- this works
|
||||
select * from ((t3 natural join (t1 natural join t2)) natural join t4)
|
||||
natural join t5;
|
||||
drop table t1, t2, t3, t4, t5;
|
||||
|
||||
# End of tests for WL#2486 - natural/using join
|
||||
|
@ -452,6 +452,14 @@ insert into t2 values(1,null);
|
||||
delete t2, t1 from t2 left join t1 on (t2.aclid=t1.aclid) where t2.refid='1';
|
||||
drop table t1, t2;
|
||||
|
||||
#
|
||||
# Bug#19225: unchecked error leads to server crash
|
||||
#
|
||||
create table t1(a int);
|
||||
create table t2(a int);
|
||||
--error 1093
|
||||
delete from t1,t2 using t1,t2 where t1.a=(select a from t1);
|
||||
drop table t1, t2;
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
|
@ -35,3 +35,13 @@ select * from t1;
|
||||
drop table t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
# Bug#19789: REPLACE was allowed for a VIEW with CHECK OPTION enabled.
|
||||
#
|
||||
CREATE TABLE t1 (f1 INT);
|
||||
CREATE VIEW v1 AS SELECT f1 FROM t1 WHERE f1 = 0 WITH CHECK OPTION;
|
||||
--error 1369
|
||||
REPLACE INTO v1 (f1) VALUES (1);
|
||||
DROP TABLE t1;
|
||||
DROP VIEW v1;
|
||||
|
@ -2217,15 +2217,6 @@ show table status like 't1%';
|
||||
select 123 as a from t1 where f1 is null;
|
||||
drop table t1,t11;
|
||||
|
||||
# Bug 7672 Unknown column error in order clause
|
||||
#
|
||||
CREATE TABLE t1 (a INT, b INT);
|
||||
(SELECT a, b AS c FROM t1) ORDER BY c+1;
|
||||
(SELECT a, b AS c FROM t1) ORDER BY b+1;
|
||||
SELECT a, b AS c FROM t1 ORDER BY c+1;
|
||||
SELECT a, b AS c FROM t1 ORDER BY b+1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #3874 (function in GROUP and LEFT JOIN)
|
||||
#
|
||||
@ -2264,6 +2255,21 @@ insert into t2 values(1,1);
|
||||
select * from t1 where f1 in (select f3 from t2 where (f3,f4)= (select f3,f4 from t2));
|
||||
drop table t1,t2;
|
||||
|
||||
#
|
||||
# Bug #4981: 4.x and 5.x produce non-optimal execution path, 3.23 regression test failure
|
||||
#
|
||||
CREATE TABLE t1(a int, b int, c int, KEY b(b), KEY c(c));
|
||||
insert into t1 values (1,0,0),(2,0,0);
|
||||
CREATE TABLE t2 (a int, b varchar(2), c varchar(2), PRIMARY KEY(a));
|
||||
insert into t2 values (1,'',''), (2,'','');
|
||||
CREATE TABLE t3 (a int, b int, PRIMARY KEY (a,b), KEY a (a), KEY b (b));
|
||||
insert into t3 values (1,1),(1,2);
|
||||
# must have "range checked" for t2
|
||||
explain select straight_join DISTINCT t2.a,t2.b, t1.c from t1, t3, t2
|
||||
where (t1.c=t2.a or (t1.c=t3.a and t2.a=t3.b)) and t1.b=556476786 and
|
||||
t2.b like '%%' order by t2.b limit 0,1;
|
||||
DROP TABLE t1,t2,t3;
|
||||
|
||||
#
|
||||
# Bug #17873: confusing error message when IGNORE INDEX refers a column name
|
||||
#
|
||||
@ -2281,48 +2287,6 @@ DROP TABLE t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
# Test case for bug 7098: substitution of a constant for a string field
|
||||
#
|
||||
|
||||
CREATE TABLE t1 ( city char(30) );
|
||||
INSERT INTO t1 VALUES ('London');
|
||||
INSERT INTO t1 VALUES ('Paris');
|
||||
|
||||
SELECT * FROM t1 WHERE city='London';
|
||||
SELECT * FROM t1 WHERE city='london';
|
||||
EXPLAIN SELECT * FROM t1 WHERE city='London' AND city='london';
|
||||
SELECT * FROM t1 WHERE city='London' AND city='london';
|
||||
EXPLAIN SELECT * FROM t1 WHERE city LIKE '%london%' AND city='London';
|
||||
SELECT * FROM t1 WHERE city LIKE '%london%' AND city='London';
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug#7425 inconsistent sort order on unsigned columns result of substraction
|
||||
#
|
||||
|
||||
create table t1 (a int(11) unsigned, b int(11) unsigned);
|
||||
insert into t1 values (1,0), (1,1), (1,2);
|
||||
select a-b from t1 order by 1;
|
||||
select a-b , (a-b < 0) from t1 order by 1;
|
||||
select a-b as d, (a-b >= 0), b from t1 group by b having d >= 0;
|
||||
select cast((a - b) as unsigned) from t1 order by 1;
|
||||
drop table t1;
|
||||
|
||||
|
||||
#
|
||||
# Bug#8733 server accepts malformed query (multiply mentioned distinct)
|
||||
#
|
||||
create table t1 (a int(11));
|
||||
select all all * from t1;
|
||||
select distinct distinct * from t1;
|
||||
--error 1221
|
||||
select all distinct * from t1;
|
||||
--error 1221
|
||||
select distinct all * from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Test for bug #6474
|
||||
#
|
||||
@ -2357,21 +2321,6 @@ SELECT K2C4, K4N4, F2I4 FROM t1
|
||||
WHERE K2C4 = 'WART' AND (K2C4 = 'WART' OR K4N4 = '0200');
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Test case for bug 7520: a wrong cost of the index for a BLOB field
|
||||
#
|
||||
|
||||
CREATE TABLE t1 ( a BLOB, INDEX (a(20)) );
|
||||
CREATE TABLE t2 ( a BLOB, INDEX (a(20)) );
|
||||
|
||||
INSERT INTO t1 VALUES ('one'),('two'),('three'),('four'),('five');
|
||||
INSERT INTO t2 VALUES ('one'),('two'),('three'),('four'),('five');
|
||||
|
||||
EXPLAIN SELECT * FROM t1 LEFT JOIN t2 USE INDEX (a) ON t1.a=t2.a;
|
||||
EXPLAIN SELECT * FROM t1 LEFT JOIN t2 FORCE INDEX (a) ON t1.a=t2.a;
|
||||
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
#
|
||||
# Bug#8670
|
||||
#
|
||||
@ -2410,34 +2359,6 @@ select distinct avg(s1) as x from t1 group by s1 with rollup;
|
||||
drop table t1;
|
||||
|
||||
|
||||
#
|
||||
# Bug#8733 server accepts malformed query (multiply mentioned distinct)
|
||||
#
|
||||
create table t1 (a int(11));
|
||||
select all all * from t1;
|
||||
select distinct distinct * from t1;
|
||||
--error 1221
|
||||
select all distinct * from t1;
|
||||
--error 1221
|
||||
select distinct all * from t1;
|
||||
drop table t1;
|
||||
|
||||
|
||||
#
|
||||
# Test case for bug 7520: a wrong cost of the index for a BLOB field
|
||||
#
|
||||
|
||||
CREATE TABLE t1 ( a BLOB, INDEX (a(20)) );
|
||||
CREATE TABLE t2 ( a BLOB, INDEX (a(20)) );
|
||||
|
||||
INSERT INTO t1 VALUES ('one'),('two'),('three'),('four'),('five');
|
||||
INSERT INTO t2 VALUES ('one'),('two'),('three'),('four'),('five');
|
||||
|
||||
EXPLAIN SELECT * FROM t1 LEFT JOIN t2 USE INDEX (a) ON t1.a=t2.a;
|
||||
EXPLAIN SELECT * FROM t1 LEFT JOIN t2 FORCE INDEX (a) ON t1.a=t2.a;
|
||||
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
#
|
||||
# Test for bug #10084: STRAIGHT_JOIN with ON expression
|
||||
#
|
||||
@ -2935,3 +2856,29 @@ EXPLAIN
|
||||
SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6 AND a > 0;
|
||||
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
#
|
||||
# Bug #18895: BIT values cause joins to fail
|
||||
#
|
||||
create table t1 (
|
||||
a int unsigned not null auto_increment primary key,
|
||||
b bit not null,
|
||||
c bit not null
|
||||
);
|
||||
|
||||
create table t2 (
|
||||
a int unsigned not null auto_increment primary key,
|
||||
b bit not null,
|
||||
c int unsigned not null,
|
||||
d varchar(50)
|
||||
);
|
||||
|
||||
insert into t1 (b,c) values (0,1), (0,1);
|
||||
insert into t2 (b,c) values (0,1);
|
||||
|
||||
-- Row 1 should succeed. Row 2 should fail. Both fail.
|
||||
select t1.a, t1.b + 0, t1.c + 0, t2.a, t2.b + 0, t2.c, t2.d
|
||||
from t1 left outer join t2 on t1.a = t2.c and t2.b <> 1
|
||||
where t1.b <> 1 order by t1.a;
|
||||
|
||||
drop table t1,t2;
|
||||
|
@ -793,3 +793,51 @@ select id from t1 union all select 99 order by 1;
|
||||
drop table t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
# Bug#18175: Union select over 129 tables with a sum function fails.
|
||||
#
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1)) union
|
||||
(select avg(1)) union (select avg(1)) union (select avg(1));
|
||||
|
||||
|
Reference in New Issue
Block a user