summaryrefslogtreecommitdiff
path: root/mysql-test/r
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2013-06-06 17:51:28 +0200
committerSergei Golubchik <sergii@pisem.net>2013-06-06 17:51:28 +0200
commit4749d40c635634e25e07d28ce1a04e9263bcc375 (patch)
treec5bb3287675cd8676d76c8ee42ef2d79cc599e25 /mysql-test/r
parent1ff1cb10fc236010b5969058cab934c2b306c931 (diff)
parent33ef993773449cb3917665b188f6b6575d399bd0 (diff)
downloadmariadb-git-4749d40c635634e25e07d28ce1a04e9263bcc375.tar.gz
5.5 merge
Diffstat (limited to 'mysql-test/r')
-rw-r--r--mysql-test/r/cast.result18
-rw-r--r--mysql-test/r/create.result4
-rw-r--r--mysql-test/r/ctype_cp932_binlog_stm.result39
-rw-r--r--mysql-test/r/ctype_ucs2_query_cache.result19
-rw-r--r--mysql-test/r/ctype_utf8mb4.result18
-rw-r--r--mysql-test/r/empty_user_table.result8
-rw-r--r--mysql-test/r/func_compress.result4
-rw-r--r--mysql-test/r/func_group.result28
-rw-r--r--mysql-test/r/func_math.result8
-rw-r--r--mysql-test/r/func_str.result11
-rw-r--r--mysql-test/r/func_time_hires.result4
-rw-r--r--mysql-test/r/gis-rtree.result20
-rw-r--r--mysql-test/r/grant_4332.result96
-rw-r--r--mysql-test/r/init_connection_query_cache.result19
-rw-r--r--mysql-test/r/innodb_ext_key.result122
-rw-r--r--mysql-test/r/join_nested.result24
-rw-r--r--mysql-test/r/join_nested_jcl6.result24
-rw-r--r--mysql-test/r/join_outer.result46
-rw-r--r--mysql-test/r/join_outer_innodb.result22
-rw-r--r--mysql-test/r/join_outer_jcl6.result46
-rw-r--r--mysql-test/r/log_slow.result15
-rw-r--r--mysql-test/r/partition.result4
-rw-r--r--mysql-test/r/select.result39
-rw-r--r--mysql-test/r/select_jcl6.result39
-rw-r--r--mysql-test/r/select_pkeycache.result39
-rw-r--r--mysql-test/r/show_check.result18
-rw-r--r--mysql-test/r/sp.result61
-rw-r--r--mysql-test/r/status_user.result2
-rw-r--r--mysql-test/r/subselect_mat.result14
-rw-r--r--mysql-test/r/subselect_sj.result32
-rw-r--r--mysql-test/r/subselect_sj2_mat.result2
-rw-r--r--mysql-test/r/subselect_sj_jcl6.result32
-rw-r--r--mysql-test/r/subselect_sj_mat.result14
-rw-r--r--mysql-test/r/type_datetime.result16
-rw-r--r--mysql-test/r/user_var-binlog.result12
-rw-r--r--mysql-test/r/varbinary.result61
-rw-r--r--mysql-test/r/variables.result6
37 files changed, 944 insertions, 42 deletions
diff --git a/mysql-test/r/cast.result b/mysql-test/r/cast.result
index 31f1d57f916..625791a7c4b 100644
--- a/mysql-test/r/cast.result
+++ b/mysql-test/r/cast.result
@@ -737,6 +737,24 @@ WHERE CAST(a as BINARY)=x'62736D697468'
AND CAST(a AS BINARY)=x'65736D697468';
a
DROP TABLE t1;
+#
+# Bug#13581962 HIGH MEMORY USAGE ATTEMPT, THEN CRASH WITH
+# LONGTEXT, UNION, USER VARIABLE
+# Bug#14096619 UNABLE TO RESTORE DATABASE DUMP
+#
+CREATE TABLE t1 AS SELECT CONCAT(CAST(REPEAT('9', 1000) AS SIGNED)),
+CONCAT(CAST(REPEAT('9', 1000) AS UNSIGNED));
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: '99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999'
+Warning 1292 Truncated incorrect INTEGER value: '99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999'
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `CONCAT(CAST(REPEAT('9', 1000) AS SIGNED))` varchar(21) NOT NULL DEFAULT '',
+ `CONCAT(CAST(REPEAT('9', 1000) AS UNSIGNED))` varchar(21) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+# End of test for Bug#13581962, Bug#14096619
End of 5.1 tests
select cast("2101-00-01 02:03:04" as datetime);
cast("2101-00-01 02:03:04" as datetime)
diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result
index 7e814283d32..d0d953f4e38 100644
--- a/mysql-test/r/create.result
+++ b/mysql-test/r/create.result
@@ -1752,7 +1752,7 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`ID` bigint(4) NOT NULL DEFAULT '0',
- `USER` varchar(16) NOT NULL DEFAULT '',
+ `USER` varchar(128) NOT NULL DEFAULT '',
`HOST` varchar(64) NOT NULL DEFAULT '',
`DB` varchar(64) DEFAULT NULL,
`COMMAND` varchar(16) NOT NULL DEFAULT '',
@@ -1772,7 +1772,7 @@ show create table t1;
Table Create Table
t1 CREATE TEMPORARY TABLE `t1` (
`ID` bigint(4) NOT NULL DEFAULT '0',
- `USER` varchar(16) NOT NULL DEFAULT '',
+ `USER` varchar(128) NOT NULL DEFAULT '',
`HOST` varchar(64) NOT NULL DEFAULT '',
`DB` varchar(64) DEFAULT NULL,
`COMMAND` varchar(16) NOT NULL DEFAULT '',
diff --git a/mysql-test/r/ctype_cp932_binlog_stm.result b/mysql-test/r/ctype_cp932_binlog_stm.result
index ead84237c2e..d5abf8d482c 100644
--- a/mysql-test/r/ctype_cp932_binlog_stm.result
+++ b/mysql-test/r/ctype_cp932_binlog_stm.result
@@ -11,7 +11,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE TABLE t1(f1 blob)
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
-master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES(0x8300)
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES(X'8300')
master-bin.000001 # Query # # COMMIT
SELECT HEX(f1) FROM t1;
HEX(f1)
@@ -47,7 +47,7 @@ BEGIN
INSERT INTO t4 VALUES (ins1, ins2, ind);
END
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
-master-bin.000001 # Query # # use `test`; INSERT INTO t4 VALUES ( NAME_CONST('ins1',_latin1 0x466F6F2773206120426172 COLLATE 'latin1_swedish_ci'), NAME_CONST('ins2',_cp932 0xED40ED41ED42 COLLATE 'cp932_japanese_ci'), NAME_CONST('ind',47.93))
+master-bin.000001 # Query # # use `test`; INSERT INTO t4 VALUES ( NAME_CONST('ins1',_latin1 X'466F6F2773206120426172' COLLATE 'latin1_swedish_ci'), NAME_CONST('ins2',_cp932 X'ED40ED41ED42' COLLATE 'cp932_japanese_ci'), NAME_CONST('ind',47.93))
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP PROCEDURE bug18293
@@ -19496,5 +19496,40 @@ EFBFA4 FA55
EFBFA5 818F
DROP TABLE t1;
#
+# Bug#MDEV-4489 Replication of big5, cp932, gbk, sjis strings makes wrong values on slave
+#
+SET NAMES cp932;
+CREATE TABLE t1 (a INT);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (0x31);
+INSERT INTO t1 VALUES (X'31');
+PREPARE stmt FROM 'INSERT INTO t1 (a) VALUES (?)';
+SET @a='1';
+SELECT charset(@a);
+charset(@a)
+cp932
+EXECUTE stmt USING @a;
+DROP PREPARE stmt;
+DROP TABLE t1;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT)
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (0x31)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (X'31')
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 (a) VALUES (X'31')
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
+#
# End of 5.5 tests
#
diff --git a/mysql-test/r/ctype_ucs2_query_cache.result b/mysql-test/r/ctype_ucs2_query_cache.result
new file mode 100644
index 00000000000..c5f1ef5918d
--- /dev/null
+++ b/mysql-test/r/ctype_ucs2_query_cache.result
@@ -0,0 +1,19 @@
+#
+# Start of 5.5 tests
+#
+#
+# Bug#MDEV-4518 Server crashes in is_white_space when it's run
+# with query cache, charset ucs2 and collation ucs2_unicode_ci
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2),(3),(4);
+SELECT * FROM t1;
+a
+1
+2
+3
+4
+DROP TABLE t1;
+#
+# End of 5.5 tests
+#
diff --git a/mysql-test/r/ctype_utf8mb4.result b/mysql-test/r/ctype_utf8mb4.result
index a956a474ef7..d8642955b89 100644
--- a/mysql-test/r/ctype_utf8mb4.result
+++ b/mysql-test/r/ctype_utf8mb4.result
@@ -2539,6 +2539,24 @@ t2 CREATE TABLE `t2` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1, t2;
#
+# Bug#13581962 HIGH MEMORY USAGE ATTEMPT, THEN CRASH WITH
+# LONGTEXT, UNION, USER VARIABLE
+# Bug#14096619 UNABLE TO RESTORE DATABASE DUMP
+#
+CREATE TABLE t1(f1 LONGTEXT CHARACTER SET utf8mb4);
+INSERT INTO t1 VALUES ('a');
+SELECT @a:= CAST(f1 AS SIGNED) FROM t1
+UNION ALL
+SELECT CAST(f1 AS SIGNED) FROM t1;
+@a:= CAST(f1 AS SIGNED)
+0
+0
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: 'a'
+Warning 1292 Truncated incorrect INTEGER value: 'a'
+DROP TABLE t1;
+# End of test for Bug#13581962,Bug#14096619
+#
# End of 5.5 tests
#
#
diff --git a/mysql-test/r/empty_user_table.result b/mysql-test/r/empty_user_table.result
new file mode 100644
index 00000000000..b93596ab59a
--- /dev/null
+++ b/mysql-test/r/empty_user_table.result
@@ -0,0 +1,8 @@
+create table t1 as select * from mysql.user;
+truncate table mysql.user;
+flush privileges;
+connect(localhost,u1,,test,MASTER_PORT,MASTER_SOCKET);
+Got one of the listed errors
+insert mysql.user select * from t1;
+drop table t1;
+flush privileges;
diff --git a/mysql-test/r/func_compress.result b/mysql-test/r/func_compress.result
index 02284186c76..c2f1e5bf273 100644
--- a/mysql-test/r/func_compress.result
+++ b/mysql-test/r/func_compress.result
@@ -11,7 +11,7 @@ explain extended select uncompress(compress(@test_compress_string));
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select uncompress(compress((@test_compress_string))) AS `uncompress(compress(@test_compress_string))`
+Note 1003 select uncompress(compress((@`test_compress_string`))) AS `uncompress(compress(@test_compress_string))`
select uncompressed_length(compress(@test_compress_string))=length(@test_compress_string);
uncompressed_length(compress(@test_compress_string))=length(@test_compress_string)
1
@@ -19,7 +19,7 @@ explain extended select uncompressed_length(compress(@test_compress_string))=len
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select (uncompressed_length(compress((@test_compress_string))) = length((@test_compress_string))) AS `uncompressed_length(compress(@test_compress_string))=length(@test_compress_string)`
+Note 1003 select (uncompressed_length(compress((@`test_compress_string`))) = length((@`test_compress_string`))) AS `uncompressed_length(compress(@test_compress_string))=length(@test_compress_string)`
select uncompressed_length(compress(@test_compress_string));
uncompressed_length(compress(@test_compress_string))
117
diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result
index c6fa040246a..38aa3f49c4d 100644
--- a/mysql-test/r/func_group.result
+++ b/mysql-test/r/func_group.result
@@ -2098,6 +2098,34 @@ avg(export_set( 3, 'y', sha(i))) group_concat(d)
0 2010-12-12
drop table t1;
#
+# MDEV-4290: crash in st_select_lex::mark_as_dependent
+#
+create table `t1`(`a` int);
+select 1 from t1 v1 right join t1 on count(*);
+ERROR HY000: Invalid use of group function
+select 1 from t1 order by
+(
+select 1 from
+(
+select 1 from t1 v1 right join t1 on count(*)
+) v
+);
+ERROR HY000: Invalid use of group function
+insert into t1 values (1),(1),(2),(2);
+select count(*) from t1;
+count(*)
+4
+select z from (select count(*) as z from t1) v;
+z
+4
+# next is how it implemented now (may be changed in case of dependent
+# derived tables)
+select z from (select count(*) as z from t1) v group by 1;
+z
+4
+drop table t1;
+# end of 5.3 tests
+#
# Bug#52123 Assertion failed: aggregator == aggr->Aggrtype(),
# file .\item_sum.cc, line 587
#
diff --git a/mysql-test/r/func_math.result b/mysql-test/r/func_math.result
index 67f3f664ad8..04e71a715ce 100644
--- a/mysql-test/r/func_math.result
+++ b/mysql-test/r/func_math.result
@@ -666,13 +666,13 @@ ERROR 22003: BIGINT value is out of range in '-(9223372036854775809)'
DROP TABLE t1;
SET @a:=999999999999999999999999999999999999999999999999999999999999999999999999999999999;
SELECT @a + @a;
-ERROR 22003: DECIMAL value is out of range in '((@a) + (@a))'
+ERROR 22003: DECIMAL value is out of range in '((@`a`) + (@`a`))'
SELECT @a * @a;
-ERROR 22003: DECIMAL value is out of range in '((@a) * (@a))'
+ERROR 22003: DECIMAL value is out of range in '((@`a`) * (@`a`))'
SELECT -@a - @a;
-ERROR 22003: DECIMAL value is out of range in '(-((@a)) - (@a))'
+ERROR 22003: DECIMAL value is out of range in '(-((@`a`)) - (@`a`))'
SELECT @a / 0.5;
-ERROR 22003: DECIMAL value is out of range in '((@a) / 0.5)'
+ERROR 22003: DECIMAL value is out of range in '((@`a`) / 0.5)'
SELECT COT(1/0);
COT(1/0)
NULL
diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result
index 16c0854241f..ad5d640b402 100644
--- a/mysql-test/r/func_str.result
+++ b/mysql-test/r/func_str.result
@@ -2911,6 +2911,17 @@ select 1 div convert(a using utf8) from t1;
1 div convert(a using utf8)
NULL
drop table t1;
+create table t1 (a int);
+create table t2 (a int);
+create procedure foo (var char(100))
+select replace(var, '00000000', table_name)
+from information_schema.tables where table_schema='test';
+call foo('(( 00000000 ++ 00000000 ))');
+replace(var, '00000000', table_name)
+(( t1 ++ t1 ))
+(( t2 ++ t2 ))
+drop procedure foo;
+drop table t1,t2;
#
# End of 5.5 tests
#
diff --git a/mysql-test/r/func_time_hires.result b/mysql-test/r/func_time_hires.result
index 73b82a6ac1f..4aa0333c4b4 100644
--- a/mysql-test/r/func_time_hires.result
+++ b/mysql-test/r/func_time_hires.result
@@ -156,12 +156,12 @@ explain extended select cast(cast(@a as datetime(4)) as time(0));
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select cast(cast((@a) as datetime(4)) as time) AS `cast(cast(@a as datetime(4)) as time(0))`
+Note 1003 select cast(cast((@`a`) as datetime(4)) as time) AS `cast(cast(@a as datetime(4)) as time(0))`
select cast(cast(@a as time(2)) as time(6));
cast(cast(@a as time(2)) as time(6))
12:13:14.120000
select CAST(@a AS DATETIME(7));
-ERROR 42000: Too big precision 7 specified for '(@a)'. Maximum is 6.
+ERROR 42000: Too big precision 7 specified for '(@`a`)'. Maximum is 6.
SELECT CONVERT_TZ('2011-01-02 12:00:00', '+00:00', '+03:00');
CONVERT_TZ('2011-01-02 12:00:00', '+00:00', '+03:00')
2011-01-02 15:00:00
diff --git a/mysql-test/r/gis-rtree.result b/mysql-test/r/gis-rtree.result
index c394aec8851..22c30479125 100644
--- a/mysql-test/r/gis-rtree.result
+++ b/mysql-test/r/gis-rtree.result
@@ -1576,3 +1576,23 @@ a ASTEXT(b)
0 POINT(1 1)
DROP TABLE t1;
End of 5.1 tests
+CREATE TABLE t1 (
+l LINESTRING NOT NULL,
+SPATIAL KEY(l)
+) ENGINE = myisam;
+INSERT INTO t1 VALUES(GeomFromText('LINESTRING(0 0, 1 1)'));
+INSERT INTO t1 VALUES(GeomFromText('LINESTRING(1 1, 2 2)'));
+INSERT INTO t1 VALUES(GeomFromText('LINESTRING(2 2, 3 3)'));
+SELECT COUNT(*) FROM t1 IGNORE INDEX(l) WHERE MBRContains(l, GEOMFROMTEXT('POINT(0 0)'));
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 IGNORE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0 0)'), l);
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 FORCE INDEX(l) WHERE MBRContains(l, GEOMFROMTEXT('POINT(0 0)'));
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 FORCE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0 0)'), l);
+COUNT(*)
+1
+DROP TABLE t1;
diff --git a/mysql-test/r/grant_4332.result b/mysql-test/r/grant_4332.result
new file mode 100644
index 00000000000..ef92b62ab32
--- /dev/null
+++ b/mysql-test/r/grant_4332.result
@@ -0,0 +1,96 @@
+select user();
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def user() 253 77 14 N 1 31 8
+user()
+root@localhost
+create user a17aaaaaaaaaaaaa0@localhost;
+ERROR HY000: String 'a17aaaaaaaaaaaaa0' is too long for user name (should be no longer than 16)
+alter table mysql.user modify User char(80) binary not null default '';
+alter table mysql.db modify User char(80) binary not null default '';
+alter table mysql.tables_priv modify User char(80) binary not null default '';
+alter table mysql.columns_priv modify User char(80) binary not null default '';
+alter table mysql.procs_priv modify User char(80) binary not null default '';
+alter table mysql.proc modify definer char(141) collate utf8_bin not null default '';
+alter table mysql.event modify definer char(141) collate utf8_bin not null default '';
+set global event_scheduler = on;
+select user();
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def user() 253 141 14 N 1 31 8
+user()
+root@localhost
+create user a17aaaaaaaaaaaaa0@localhost;
+grant usage on *.* to a17aaaaaaaaaaaaa0@localhost;
+grant select on mysql.user to b64bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb0@localhost;
+grant select(User) on mysql.tables_priv to c80cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc0@localhost;
+select user(), current_user();
+user() current_user()
+a17aaaaaaaaaaaaa0@localhost a17aaaaaaaaaaaaa0@localhost
+show grants;
+Grants for a17aaaaaaaaaaaaa0@localhost
+GRANT USAGE ON *.* TO 'a17aaaaaaaaaaaaa0'@'localhost'
+select user(), current_user();
+user() current_user()
+b64bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb0@localhost b64bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb0@localhost
+show grants;
+Grants for b64bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb0@localhost
+GRANT USAGE ON *.* TO 'b64bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb0'@'localhost'
+GRANT SELECT ON `mysql`.`user` TO 'b64bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb0'@'localhost'
+select user,host from mysql.user where user like '%0';
+user host
+a17aaaaaaaaaaaaa0 localhost
+b64bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb0 localhost
+c80cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc0 localhost
+select user,host from mysql.db;
+ERROR 42000: SELECT command denied to user 'b64bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'@'localhost' for table 'db'
+select user(), current_user();
+user() current_user()
+c80cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc0@localhost c80cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc0@localhost
+show grants;
+Grants for c80cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc0@localhost
+GRANT USAGE ON *.* TO 'c80cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc0'@'localhost'
+GRANT SELECT (User) ON `mysql`.`tables_priv` TO 'c80cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc0'@'localhost'
+select user from mysql.tables_priv;
+user
+b64bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb0
+c80cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc0
+select user,host from mysql.tables_priv;
+ERROR 42000: SELECT command denied to user 'c80ccccccccccccccccccccccccccccccccccccccccccccc'@'localhost' for column 'host' in table 'tables_priv'
+create procedure test.p1() select user(), current_user(), user from mysql.tables_priv;
+show create procedure test.p1;
+Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
+p1 CREATE DEFINER=`c80cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc0`@`localhost` PROCEDURE `p1`()
+select user(), current_user(), user from mysql.tables_priv latin1 latin1_swedish_ci latin1_swedish_ci
+create table test.t1 (a text);
+create event e1 on schedule every 1 second
+do insert test.t1 values (concat(user(), ' ', current_user()));
+call test.p1();
+user() current_user() user
+root@localhost c80cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc0@localhost b64bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb0
+root@localhost c80cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc0@localhost c80cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc0
+select * from t1 limit 1;
+a
+event_scheduler@localhost c80cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc0@localhost
+grant usage on *.* to d81ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd0@lodalhost;
+ERROR HY000: String 'd81ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd' is too long for user name (should be no longer than 80)
+drop user d81ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd0@lodalhost;
+ERROR HY000: String 'd81ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd' is too long for user name (should be no longer than 80)
+drop user c80cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc0@localhost;
+drop user b64bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb0@localhost;
+drop user a17aaaaaaaaaaaaa0@localhost;
+set global event_scheduler = off;
+drop event e1;
+drop procedure test.p1;
+drop table t1;
+alter table mysql.user modify User char(16) binary not null default '';
+alter table mysql.db modify User char(16) binary not null default '';
+alter table mysql.tables_priv modify User char(16) binary not null default '';
+alter table mysql.columns_priv modify User char(16) binary not null default '';
+alter table mysql.procs_priv modify User char(16) binary not null default '';
+alter table mysql.proc modify definer char(77) collate utf8_bin not null default '';
+alter table mysql.event modify definer char(77) collate utf8_bin not null default '';
+flush privileges;
+select user();
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def user() 253 77 14 N 1 31 8
+user()
+root@localhost
diff --git a/mysql-test/r/init_connection_query_cache.result b/mysql-test/r/init_connection_query_cache.result
new file mode 100644
index 00000000000..5a1e5c5244f
--- /dev/null
+++ b/mysql-test/r/init_connection_query_cache.result
@@ -0,0 +1,19 @@
+#
+# MDEV-4520: Assertion `0' fails in Query_cache::end_of_result on
+# concurrent drop event and event execution
+#
+set GLOBAL query_cache_size=1355776;
+create user mysqltest1@localhost;
+grant SELECT on test.* to mysqltest1@localhost;
+create table t1 (a int);
+# This explain put here to be sure that init connection query
+# has 'Impossible WHERE'.
+explain extended select * from test.t1 where 0;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0
+revoke all privileges, grant option from mysqltest1@localhost;
+drop user mysqltest1@localhost;
+drop table t1;
+set GLOBAL query_cache_size=default;
diff --git a/mysql-test/r/innodb_ext_key.result b/mysql-test/r/innodb_ext_key.result
index 0da4feaf26f..4a6b902e869 100644
--- a/mysql-test/r/innodb_ext_key.result
+++ b/mysql-test/r/innodb_ext_key.result
@@ -865,6 +865,128 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL # Using where
1 SIMPLE t3 ref PRIMARY,col1 col1 12 test.t1.a,test.t1.a,test.t1.a # Using index
drop table t1,t2,t3;
+#
+# Bug mdev-4340: performance regression with extended_keys=on
+#
+set @save_optimizer_switch=@@optimizer_switch;
+CREATE TABLE t1 (
+page_id int(8) unsigned NOT NULL AUTO_INCREMENT,
+page_namespace int(11) NOT NULL DEFAULT '0',
+page_title varbinary(255) NOT NULL DEFAULT '',
+page_restrictions tinyblob NOT NULL,
+page_counter bigint(20) unsigned NOT NULL DEFAULT '0',
+page_is_redirect tinyint(1) unsigned NOT NULL DEFAULT '0',
+page_is_new tinyint(1) unsigned NOT NULL DEFAULT '0',
+page_random double unsigned NOT NULL DEFAULT '0',
+page_touched varbinary(14) NOT NULL DEFAULT '',
+page_latest int(8) unsigned NOT NULL DEFAULT '0',
+page_len int(8) unsigned NOT NULL DEFAULT '0',
+PRIMARY KEY (page_id),
+UNIQUE KEY name_title (page_namespace,page_title),
+KEY page_random (page_random),
+KEY page_len (page_len),
+KEY page_redirect_namespace_len (page_is_redirect,page_namespace,page_len)
+) ENGINE=InnoDB AUTO_INCREMENT=38929100 DEFAULT CHARSET=binary;
+INSERT INTO t1 VALUES
+(38928077,0,'Sandbox','',0,0,0,0,'',0,0),(38928078,1,'Sandbox','',0,0,0,1,'',0,0),
+(38928079,2,'Sandbox','',0,0,0,2,'',0,0),(38928080,3,'Sandbox','',0,0,0,3,'',0,0),
+(38928081,4,'Sandbox','',0,0,0,4,'',0,0),(38928082,5,'Sandbox','',0,0,0,5,'',0,0);
+CREATE TABLE t2 (
+rev_id int(8) unsigned NOT NULL AUTO_INCREMENT,
+rev_page int(8) unsigned NOT NULL DEFAULT '0',
+rev_text_id int(8) unsigned NOT NULL DEFAULT '0',
+rev_comment varbinary(255) DEFAULT NULL,
+rev_user int(5) unsigned NOT NULL DEFAULT '0',
+rev_user_text varbinary(255) NOT NULL DEFAULT '',
+rev_timestamp varbinary(14) NOT NULL DEFAULT '',
+rev_minor_edit tinyint(1) unsigned NOT NULL DEFAULT '0',
+rev_deleted tinyint(1) unsigned NOT NULL DEFAULT '0',
+rev_len int(8) unsigned DEFAULT NULL,
+rev_parent_id int(8) unsigned DEFAULT NULL,
+rev_sha1 varbinary(32) NOT NULL DEFAULT '',
+PRIMARY KEY (rev_page,rev_id),
+UNIQUE KEY rev_id (rev_id),
+KEY rev_timestamp (rev_timestamp),
+KEY page_timestamp (rev_page,rev_timestamp),
+KEY user_timestamp (rev_user,rev_timestamp),
+KEY usertext_timestamp (rev_user_text,rev_timestamp,rev_user,rev_deleted,rev_minor_edit,rev_text_id,rev_comment)
+) ENGINE=InnoDB DEFAULT CHARSET=binary;
+INSERT INTO t2 VALUES
+(547116222,20,0,NULL,3,'','',0,0,NULL,NULL,''),(547117245,20,0,NULL,4,'','',0,0,NULL,NULL,''),
+(547118268,20,0,NULL,5,'','',0,0,NULL,NULL,''),(547114177,21,0,NULL,1,'','',0,0,NULL,NULL,''),
+(547115200,21,0,NULL,2,'','',0,0,NULL,NULL,''),(547116223,21,0,NULL,3,'','',0,0,NULL,NULL,''),
+(547117246,21,0,NULL,4,'','',0,0,NULL,NULL,''),(547118269,21,0,NULL,5,'','',0,0,NULL,NULL,''),
+(547114178,22,0,NULL,1,'','',0,0,NULL,NULL,''),(547115201,22,0,NULL,2,'','',0,0,NULL,NULL,''),
+(547116224,22,0,NULL,3,'','',0,0,NULL,NULL,''),(547117247,22,0,NULL,4,'','',0,0,NULL,NULL,''),
+(547116226,24,0,NULL,3,'','',0,0,NULL,NULL,''),(547117249,24,0,NULL,4,'','',0,0,NULL,NULL,''),
+(547118272,24,0,NULL,5,'','',0,0,NULL,NULL,''),(547114181,25,0,NULL,1,'','',0,0,NULL,NULL,''),
+(547115204,25,0,NULL,2,'','',0,0,NULL,NULL,''),(547116227,25,0,NULL,3,'','',0,0,NULL,NULL,''),
+(547116157,978,0,NULL,2,'','',0,0,NULL,NULL,''),(547117180,978,0,NULL,3,'','',0,0,NULL,NULL,''),
+(547118203,978,0,NULL,4,'','',0,0,NULL,NULL,''),(547119226,978,0,NULL,5,'','',0,0,NULL,NULL,''),
+(547115135,979,0,NULL,1,'','',0,0,NULL,NULL,''),(547116158,979,0,NULL,2,'','',0,0,NULL,NULL,''),
+(547116173,994,0,NULL,2,'','',0,0,NULL,NULL,''),(547117196,994,0,NULL,3,'','',0,0,NULL,NULL,''),
+(547118219,994,0,NULL,4,'','',0,0,NULL,NULL,''),(547119242,994,0,NULL,5,'','',0,0,NULL,NULL,''),
+(547115151,995,0,NULL,1,'','',0,0,NULL,NULL,''),(547116174,995,0,NULL,2,'','',0,0,NULL,NULL,''),
+(547117197,995,0,NULL,3,'','',0,0,NULL,NULL,''),(547118220,995,0,NULL,4,'','',0,0,NULL,NULL,''),
+(547118223,998,0,NULL,4,'','',0,0,NULL,NULL,''),(547119246,998,0,NULL,5,'','',0,0,NULL,NULL,''),
+(547115155,999,0,NULL,1,'','',0,0,NULL,NULL,''),(547116178,999,0,NULL,2,'','',0,0,NULL,NULL,''),
+(547117201,999,0,NULL,3,'','',0,0,NULL,NULL,''),(547118224,999,0,NULL,4,'','',0,0,NULL,NULL,''),
+(547119271,38928081,0,NULL,10,'','',0,0,NULL,NULL,''),(547119272,38928081,0,NULL,11,'','',0,0,NULL,NULL,''),
+(547119273,38928081,0,NULL,12,'','',0,0,NULL,NULL,''),(547119274,38928081,0,NULL,13,'','',0,0,NULL,NULL,''),
+(547119275,38928081,0,NULL,14,'','',0,0,NULL,NULL,''),(547119276,38928081,0,NULL,15,'','',0,0,NULL,NULL,''),
+(547119277,38928081,0,NULL,16,'','',0,0,NULL,NULL,''),(547119278,38928081,0,NULL,17,'','',0,0,NULL,NULL,''),
+(547119279,38928081,0,NULL,18,'','',0,0,NULL,NULL,''),(547119280,38928081,0,NULL,19,'','',0,0,NULL,NULL,'');
+CREATE TABLE t3 (
+old_id int(10) unsigned NOT NULL AUTO_INCREMENT,
+old_text mediumblob NOT NULL,
+old_flags tinyblob NOT NULL,
+PRIMARY KEY (old_id)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+INSERT INTO t3 VALUES
+(1,'text-0',''),(2,'text-1000',''),(3,'text-2000',''),(4,'text-3000',''),
+(5,'text-4000',''),(6,'text-5000',''),(7,'text-6000',''),(8,'text-7000',''),
+(9,'text-8000',''),(10,'text-9000',''),(11,'text-1',''),(12,'text-1001',''),
+(13,'text-2001',''),(14,'text-3001',''),(15,'text-4001',''),(16,'text-5001',''),
+(17,'text-6001',''),(18,'text-7001',''),(19,'text-8001',''),(20,'text-9001',''),
+(21,'text-2',''),(22,'text-1002',''),(23,'text-2002',''),(24,'text-3002',''),
+(25,'text-4002',''),(26,'text-5002',''),(27,'text-6002',''),(28,'text-7002',''),
+(29,'text-8002',''),(30,'text-9002',''),(31,'text-3',''),(32,'text-1003',''),
+(33,'text-2003',''),(34,'text-3003',''),(35,'text-4003',''),(36,'text-5003',''),
+(37,'text-6003',''),(38,'text-7003',''),(39,'text-8003',''),(40,'text-9003',''),
+(41,'text-4',''),(42,'text-1004',''),(43,'text-2004',''),(44,'text-3004',''),
+(45,'text-4004',''),(46,'text-5004',''),(47,'text-6004',''),(48,'text-7004',''),
+(49,'text-8004',''),(50,'text-9004',''),(51,'text-5',''),(52,'text-1005',''),
+(53,'text-2005',''),(54,'text-3005',''),(55,'text-4005',''),(56,'text-5005',''),
+(57,'text-6005',''),(58,'text-7005',''),(59,'text-8005',''),(60,'text-9005',''),
+(61,'text-6',''),(62,'text-1006',''),(63,'text-2006',''),(64,'text-3006',''),
+(65,'text-4006',''),(66,'text-5006',''),(67,'text-6006',''),(68,'text-7006',''),
+(69,'text-8006',''),(70,'text-9006',''),(71,'text-7',''),(72,'text-1007',''),
+(73,'text-2007',''),(74,'text-3007',''),(75,'text-4007',''),(76,'text-5007',''),
+(77,'text-6007',''),(78,'text-7007',''),(79,'text-8007',''),(80,'text-9007',''),
+(81,'text-8',''),(82,'text-1008',''),(83,'text-2008',''),(84,'text-3008',''),
+(85,'text-4008',''),(86,'text-5008',''),(87,'text-6008',''),(88,'text-7008',''),
+(89,'text-8008',''),(90,'text-9008',''),(91,'text-9',''),(92,'text-1009',''),
+(93,'text-2009',''),(94,'text-3009',''),(95,'text-4009',''),(96,'text-5009',''),
+(97,'text-6009',''),(98,'text-7009',''),(99,'text-8009',''),(100,'text-9009','');
+set optimizer_switch='extended_keys=off';
+EXPLAIN
+SELECT * FROM t1, t2 IGNORE INDEX (PRIMARY), t3
+WHERE page_id=rev_page AND rev_text_id=old_id AND page_namespace=4 AND page_title='Sandbox'
+ORDER BY rev_timestamp ASC LIMIT 10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 const PRIMARY,name_title name_title 261 const,const 1
+1 SIMPLE t2 ref page_timestamp page_timestamp 4 const 10 Using where
+1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.rev_text_id 1
+set optimizer_switch='extended_keys=on';
+EXPLAIN
+SELECT * FROM t1, t2 IGNORE INDEX (PRIMARY), t3
+WHERE page_id=rev_page AND rev_text_id=old_id AND page_namespace=4 AND page_title='Sandbox'
+ORDER BY rev_timestamp ASC LIMIT 10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 const PRIMARY,name_title name_title 261 const,const 1
+1 SIMPLE t2 ref page_timestamp page_timestamp 4 const 10 Using where
+1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.rev_text_id 1
+DROP TABLE t1,t2,t3;
set optimizer_switch=@save_optimizer_switch;
set optimizer_switch=@save_ext_key_optimizer_switch;
SET SESSION STORAGE_ENGINE=DEFAULT;
diff --git a/mysql-test/r/join_nested.result b/mysql-test/r/join_nested.result
index 255714a7236..84b6ff640e9 100644
--- a/mysql-test/r/join_nested.result
+++ b/mysql-test/r/join_nested.result
@@ -1847,3 +1847,27 @@ Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `a`,`test`.`t3`.`a` A
DROP TABLE t1,t2,t3,t4;
SET optimizer_switch=@save_optimizer_switch;
End of 5.0 tests
+#
+# MDEV-621: LP:693329 - Assertion `!is_interleave_error' failed on low optimizer_search_depth
+#
+set @tmp_mdev621= @@optimizer_search_depth;
+SET SESSION optimizer_search_depth = 4;
+CREATE TABLE t1 (f1 int,f2 int,f3 int,f4 int) ;
+INSERT IGNORE INTO t1 VALUES (0,0,2,0),(NULL,0,2,0);
+CREATE TABLE t2 (f1 int) ;
+CREATE TABLE t3 (f3 int,PRIMARY KEY (f3)) ;
+CREATE TABLE t4 (f5 int) ;
+CREATE TABLE t5 (f2 int) ;
+SELECT alias2.f4 FROM t1 AS alias1
+LEFT JOIN t1 AS alias2
+LEFT JOIN t2 AS alias3
+LEFT JOIN t3 AS alias4 ON alias3.f1 = alias4.f3
+ON alias2.f1
+LEFT JOIN t4 AS alias5
+JOIN t5 ON alias5.f5
+ON alias2.f3 ON alias1.f2;
+f4
+NULL
+NULL
+DROP TABLE t1,t2,t3,t4,t5;
+set optimizer_search_depth= @tmp_mdev621;
diff --git a/mysql-test/r/join_nested_jcl6.result b/mysql-test/r/join_nested_jcl6.result
index c744df9e2fe..6b5a50ba978 100644
--- a/mysql-test/r/join_nested_jcl6.result
+++ b/mysql-test/r/join_nested_jcl6.result
@@ -1858,6 +1858,30 @@ Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `a`,`test`.`t3`.`a` A
DROP TABLE t1,t2,t3,t4;
SET optimizer_switch=@save_optimizer_switch;
End of 5.0 tests
+#
+# MDEV-621: LP:693329 - Assertion `!is_interleave_error' failed on low optimizer_search_depth
+#
+set @tmp_mdev621= @@optimizer_search_depth;
+SET SESSION optimizer_search_depth = 4;
+CREATE TABLE t1 (f1 int,f2 int,f3 int,f4 int) ;
+INSERT IGNORE INTO t1 VALUES (0,0,2,0),(NULL,0,2,0);
+CREATE TABLE t2 (f1 int) ;
+CREATE TABLE t3 (f3 int,PRIMARY KEY (f3)) ;
+CREATE TABLE t4 (f5 int) ;
+CREATE TABLE t5 (f2 int) ;
+SELECT alias2.f4 FROM t1 AS alias1
+LEFT JOIN t1 AS alias2
+LEFT JOIN t2 AS alias3
+LEFT JOIN t3 AS alias4 ON alias3.f1 = alias4.f3
+ON alias2.f1
+LEFT JOIN t4 AS alias5
+JOIN t5 ON alias5.f5
+ON alias2.f3 ON alias1.f2;
+f4
+NULL
+NULL
+DROP TABLE t1,t2,t3,t4,t5;
+set optimizer_search_depth= @tmp_mdev621;
CREATE TABLE t5 (a int, b int, c int, PRIMARY KEY(a), KEY b_i (b));
CREATE TABLE t6 (a int, b int, c int, PRIMARY KEY(a), KEY b_i (b));
CREATE TABLE t7 (a int, b int, c int, PRIMARY KEY(a), KEY b_i (b));
diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result
index c28887d4ff2..8920539ef2e 100644
--- a/mysql-test/r/join_outer.result
+++ b/mysql-test/r/join_outer.result
@@ -1853,6 +1853,38 @@ WHERE t1.f1 = 4 AND t2.f1 IS NOT NULL AND t2.f2 IS NOT NULL
GROUP BY t2.f1, t2.f2;
f1 f1 f2
DROP TABLE t1,t2;
+#
+# Bug#13068506 - QUERY WITH GROUP BY ON NON-AGGR COLUMN RETURNS
+# WRONG RESULT
+#
+CREATE TABLE t1 (i1 int);
+INSERT INTO t1 VALUES (100), (101);
+CREATE TABLE t2 (i2 int, i3 int);
+INSERT INTO t2 VALUES (20,1),(10,2);
+CREATE TABLE t3 (i4 int(11));
+INSERT INTO t3 VALUES (1),(2);
+
+SELECT (
+SELECT MAX( t2.i2 )
+FROM t3 RIGHT JOIN t2 ON ( t2.i3 = 2 )
+WHERE t2.i3 <> t1.i1
+) AS field1
+FROM t1;;
+field1
+20
+20
+
+SELECT (
+SELECT MAX( t2.i2 )
+FROM t3 RIGHT JOIN t2 ON ( t2.i3 = 2 )
+WHERE t2.i3 <> t1.i1
+) AS field1
+FROM t1 GROUP BY field1;;
+field1
+20
+
+drop table t1,t2,t3;
+# End of test for Bug#13068506
End of 5.1 tests
#
# LP BUG#994392: Wrong result with RIGHT/LEFT JOIN and ALL subquery
@@ -2071,4 +2103,18 @@ b c d
5 8 88
5 8 81
DROP TABLE t1,t2;
+#
+# Bug mdev-4336: LEFT JOIN with disjunctive
+# <non-nullable datetime field> IS NULL in WHERE
+# causes a hang and eventual crash
+#
+CREATE TABLE t1 (
+id int(11) NOT NULL,
+modified datetime NOT NULL,
+PRIMARY KEY (id)
+);
+SELECT a.* FROM t1 a LEFT JOIN t1 b ON a.id = b.id
+WHERE a.modified > b.modified or b.modified IS NULL;
+id modified
+DROP TABLE t1;
SET optimizer_switch=@save_optimizer_switch;
diff --git a/mysql-test/r/join_outer_innodb.result b/mysql-test/r/join_outer_innodb.result
index 0184e236d14..1081fc0eed3 100644
--- a/mysql-test/r/join_outer_innodb.result
+++ b/mysql-test/r/join_outer_innodb.result
@@ -476,3 +476,25 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t10 ALL PRIMARY NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join)
drop view v1;
drop table t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16;
+#
+# MDEV-4270: crash in fix_semijoin_strategies_for_picked_join_order
+#
+drop table if exists t1,t2,t3;
+Warnings:
+Note 1051 Unknown table 't1'
+Note 1051 Unknown table 't2'
+Note 1051 Unknown table 't3'
+create table t2(a int,unique key (a)) engine=innodb;
+create table t3(b int) engine=innodb;
+create table t1(a int,b int)engine=innodb;
+set @mdev4270_opl= @@optimizer_prune_level;
+set @mdev4270_osd= @@optimizer_search_depth;
+set optimizer_prune_level=0;
+set optimizer_search_depth=2;
+select 1 from t1 join t2 a
+natural left join t2 b
+natural right outer join t3;
+1
+drop table t1,t2,t3;
+set optimizer_prune_level=@mdev4270_opl;
+set optimizer_search_depth=@mdev4270_osd;
diff --git a/mysql-test/r/join_outer_jcl6.result b/mysql-test/r/join_outer_jcl6.result
index 4efb6126cba..43443aa2fef 100644
--- a/mysql-test/r/join_outer_jcl6.result
+++ b/mysql-test/r/join_outer_jcl6.result
@@ -1864,6 +1864,38 @@ WHERE t1.f1 = 4 AND t2.f1 IS NOT NULL AND t2.f2 IS NOT NULL
GROUP BY t2.f1, t2.f2;
f1 f1 f2
DROP TABLE t1,t2;
+#
+# Bug#13068506 - QUERY WITH GROUP BY ON NON-AGGR COLUMN RETURNS
+# WRONG RESULT
+#
+CREATE TABLE t1 (i1 int);
+INSERT INTO t1 VALUES (100), (101);
+CREATE TABLE t2 (i2 int, i3 int);
+INSERT INTO t2 VALUES (20,1),(10,2);
+CREATE TABLE t3 (i4 int(11));
+INSERT INTO t3 VALUES (1),(2);
+
+SELECT (
+SELECT MAX( t2.i2 )
+FROM t3 RIGHT JOIN t2 ON ( t2.i3 = 2 )
+WHERE t2.i3 <> t1.i1
+) AS field1
+FROM t1;;
+field1
+20
+20
+
+SELECT (
+SELECT MAX( t2.i2 )
+FROM t3 RIGHT JOIN t2 ON ( t2.i3 = 2 )
+WHERE t2.i3 <> t1.i1
+) AS field1
+FROM t1 GROUP BY field1;;
+field1
+20
+
+drop table t1,t2,t3;
+# End of test for Bug#13068506
End of 5.1 tests
#
# LP BUG#994392: Wrong result with RIGHT/LEFT JOIN and ALL subquery
@@ -2082,6 +2114,20 @@ b c d
5 8 88
5 8 81
DROP TABLE t1,t2;
+#
+# Bug mdev-4336: LEFT JOIN with disjunctive
+# <non-nullable datetime field> IS NULL in WHERE
+# causes a hang and eventual crash
+#
+CREATE TABLE t1 (
+id int(11) NOT NULL,
+modified datetime NOT NULL,
+PRIMARY KEY (id)
+);
+SELECT a.* FROM t1 a LEFT JOIN t1 b ON a.id = b.id
+WHERE a.modified > b.modified or b.modified IS NULL;
+id modified
+DROP TABLE t1;
SET optimizer_switch=@save_optimizer_switch;
set join_cache_level=default;
show variables like 'join_cache_level';
diff --git a/mysql-test/r/log_slow.result b/mysql-test/r/log_slow.result
index 76cf45631bd..6500ba3ca53 100644
--- a/mysql-test/r/log_slow.result
+++ b/mysql-test/r/log_slow.result
@@ -13,6 +13,7 @@ log_slow_filter admin,filesort,filesort_on_disk,full_join,full_scan,query_cache,
log_slow_queries ON
log_slow_rate_limit 1
log_slow_verbosity
+set @org_slow_query_log= @@global.slow_query_log;
set @@log_slow_filter= "filesort,filesort_on_disk,full_join,full_scan,query_cache,query_cache_miss,tmp_table,tmp_table_on_disk,admin";
select @@log_slow_filter;
@@log_slow_filter
@@ -56,5 +57,19 @@ insert_id int(11) NO NULL
server_id int(10) unsigned NO NULL
sql_text mediumtext NO NULL
flush slow logs;
+set long_query_time=0.1;
+set log_slow_filter='';
+set global slow_query_log=1;
+set global log_output='TABLE';
+select sleep(0.5);
+sleep(0.5)
+0
+select count(*) FROM mysql.slow_log;
+count(*)
+1
+truncate mysql.slow_log;
+set @@long_query_time=default;
+set global slow_query_log= @org_slow_query_log;
set @@log_slow_filter=default;
set @@log_slow_verbosity=default;
+set global log_output= default;
diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result
index c6a806bec80..c68d43831ad 100644
--- a/mysql-test/r/partition.result
+++ b/mysql-test/r/partition.result
@@ -1764,13 +1764,13 @@ engine=MEMORY
partition by key (a);
REPAIR TABLE t1;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize note The storage engine for the table doesn't support optimize
CHECK TABLE t1;
Table Op Msg_type Msg_text
-test.t1 check note The storage engine for the table doesn't support check
+test.t1 check status OK
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze note The storage engine for the table doesn't support analyze
diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result
index 3d16d37c5f1..c086a62275a 100644
--- a/mysql-test/r/select.result
+++ b/mysql-test/r/select.result
@@ -2921,8 +2921,8 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 3
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join)
DROP TABLE t1,t2;
-select x'10' + 0, X'10' + 0, b'10' + 0, B'10' + 0;
-x'10' + 0 X'10' + 0 b'10' + 0 B'10' + 0
+select x'3136' + 0, X'3136' + 0, b'10' + 0, B'10' + 0;
+x'3136' + 0 X'3136' + 0 b'10' + 0 B'10' + 0
16 16 2 2
create table t1 (f1 varchar(6) default NULL, f2 int(6) primary key not null);
create table t2 (f3 varchar(5) not null, f4 varchar(5) not null, UNIQUE KEY UKEY (f3,f4));
@@ -5119,6 +5119,7 @@ SELECT 1 FROM t1 GROUP BY 1;
1
1
drop table t1;
+set sql_buffer_result= 0;
#
# Bug #58422: Incorrect result when OUTER JOIN'ing
# with an empty table
@@ -5322,4 +5323,38 @@ AND Time_zone_id = Time_zone_id
OR Time_zone_id <> Time_zone_id )
AND Use_leap_seconds <> 'N';
Time_zone_id Use_leap_seconds
+#
+# Bug mdev-4274: result of simplification of OR badly merged
+# into embedding AND
+#
+CREATE TABLE t1 (a int, b int, INDEX idx(b)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (8,8);
+CREATE TABLE t2 (c int, INDEX idx(c)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (8), (9);
+EXPLAIN EXTENDED
+SELECT * FROM t1 INNER JOIN t2 ON ( c = a )
+WHERE 1 IS NULL OR b < 33 AND b = c;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 system idx NULL NULL NULL 1 100.00
+1 SIMPLE t2 ref idx idx 5 const 1 100.00 Using index
+Warnings:
+Note 1003 select 8 AS `a`,8 AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where ((`test`.`t2`.`c` = 8) and 1)
+SELECT * FROM t1 INNER JOIN t2 ON ( c = a )
+WHERE 1 IS NULL OR b < 33 AND b = c;
+a b c
+8 8 8
+DROP TABLE t1,t2;
+#
+# Bug mdev-4413: another manifestations of bug mdev-2474
+# (valgrind complains)
+#
+CREATE TABLE t1 (a int, b int) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (7,1);
+CREATE TABLE t2 (c int) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (0), (8);
+SELECT * FROM t1, t2
+WHERE c = a AND
+( 0 OR ( b BETWEEN 45 AND 300 OR a > 45 AND a < 100 ) AND b = c );
+a b c
+DROP TABLE t1, t2;
End of 5.3 tests
diff --git a/mysql-test/r/select_jcl6.result b/mysql-test/r/select_jcl6.result
index 467f940c85d..00b356fc1c0 100644
--- a/mysql-test/r/select_jcl6.result
+++ b/mysql-test/r/select_jcl6.result
@@ -2932,8 +2932,8 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where
1 SIMPLE t1 hash_ALL NULL #hash#$hj 5 test.t2.a 5 Using where; Using join buffer (flat, BNLH join)
DROP TABLE t1,t2;
-select x'10' + 0, X'10' + 0, b'10' + 0, B'10' + 0;
-x'10' + 0 X'10' + 0 b'10' + 0 B'10' + 0
+select x'3136' + 0, X'3136' + 0, b'10' + 0, B'10' + 0;
+x'3136' + 0 X'3136' + 0 b'10' + 0 B'10' + 0
16 16 2 2
create table t1 (f1 varchar(6) default NULL, f2 int(6) primary key not null);
create table t2 (f3 varchar(5) not null, f4 varchar(5) not null, UNIQUE KEY UKEY (f3,f4));
@@ -5130,6 +5130,7 @@ SELECT 1 FROM t1 GROUP BY 1;
1
1
drop table t1;
+set sql_buffer_result= 0;
#
# Bug #58422: Incorrect result when OUTER JOIN'ing
# with an empty table
@@ -5333,6 +5334,40 @@ AND Time_zone_id = Time_zone_id
OR Time_zone_id <> Time_zone_id )
AND Use_leap_seconds <> 'N';
Time_zone_id Use_leap_seconds
+#
+# Bug mdev-4274: result of simplification of OR badly merged
+# into embedding AND
+#
+CREATE TABLE t1 (a int, b int, INDEX idx(b)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (8,8);
+CREATE TABLE t2 (c int, INDEX idx(c)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (8), (9);
+EXPLAIN EXTENDED
+SELECT * FROM t1 INNER JOIN t2 ON ( c = a )
+WHERE 1 IS NULL OR b < 33 AND b = c;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 system idx NULL NULL NULL 1 100.00
+1 SIMPLE t2 ref idx idx 5 const 1 100.00 Using index
+Warnings:
+Note 1003 select 8 AS `a`,8 AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where ((`test`.`t2`.`c` = 8) and 1)
+SELECT * FROM t1 INNER JOIN t2 ON ( c = a )
+WHERE 1 IS NULL OR b < 33 AND b = c;
+a b c
+8 8 8
+DROP TABLE t1,t2;
+#
+# Bug mdev-4413: another manifestations of bug mdev-2474
+# (valgrind complains)
+#
+CREATE TABLE t1 (a int, b int) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (7,1);
+CREATE TABLE t2 (c int) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (0), (8);
+SELECT * FROM t1, t2
+WHERE c = a AND
+( 0 OR ( b BETWEEN 45 AND 300 OR a > 45 AND a < 100 ) AND b = c );
+a b c
+DROP TABLE t1, t2;
End of 5.3 tests
set join_cache_level=default;
show variables like 'join_cache_level';
diff --git a/mysql-test/r/select_pkeycache.result b/mysql-test/r/select_pkeycache.result
index 3d16d37c5f1..c086a62275a 100644
--- a/mysql-test/r/select_pkeycache.result
+++ b/mysql-test/r/select_pkeycache.result
@@ -2921,8 +2921,8 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 3
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join)
DROP TABLE t1,t2;
-select x'10' + 0, X'10' + 0, b'10' + 0, B'10' + 0;
-x'10' + 0 X'10' + 0 b'10' + 0 B'10' + 0
+select x'3136' + 0, X'3136' + 0, b'10' + 0, B'10' + 0;
+x'3136' + 0 X'3136' + 0 b'10' + 0 B'10' + 0
16 16 2 2
create table t1 (f1 varchar(6) default NULL, f2 int(6) primary key not null);
create table t2 (f3 varchar(5) not null, f4 varchar(5) not null, UNIQUE KEY UKEY (f3,f4));
@@ -5119,6 +5119,7 @@ SELECT 1 FROM t1 GROUP BY 1;
1
1
drop table t1;
+set sql_buffer_result= 0;
#
# Bug #58422: Incorrect result when OUTER JOIN'ing
# with an empty table
@@ -5322,4 +5323,38 @@ AND Time_zone_id = Time_zone_id
OR Time_zone_id <> Time_zone_id )
AND Use_leap_seconds <> 'N';
Time_zone_id Use_leap_seconds
+#
+# Bug mdev-4274: result of simplification of OR badly merged
+# into embedding AND
+#
+CREATE TABLE t1 (a int, b int, INDEX idx(b)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (8,8);
+CREATE TABLE t2 (c int, INDEX idx(c)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (8), (9);
+EXPLAIN EXTENDED
+SELECT * FROM t1 INNER JOIN t2 ON ( c = a )
+WHERE 1 IS NULL OR b < 33 AND b = c;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 system idx NULL NULL NULL 1 100.00
+1 SIMPLE t2 ref idx idx 5 const 1 100.00 Using index
+Warnings:
+Note 1003 select 8 AS `a`,8 AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where ((`test`.`t2`.`c` = 8) and 1)
+SELECT * FROM t1 INNER JOIN t2 ON ( c = a )
+WHERE 1 IS NULL OR b < 33 AND b = c;
+a b c
+8 8 8
+DROP TABLE t1,t2;
+#
+# Bug mdev-4413: another manifestations of bug mdev-2474
+# (valgrind complains)
+#
+CREATE TABLE t1 (a int, b int) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (7,1);
+CREATE TABLE t2 (c int) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (0), (8);
+SELECT * FROM t1, t2
+WHERE c = a AND
+( 0 OR ( b BETWEEN 45 AND 300 OR a > 45 AND a < 100 ) AND b = c );
+a b c
+DROP TABLE t1, t2;
End of 5.3 tests
diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result
index 2b7439b09e0..809aef3ac99 100644
--- a/mysql-test/r/show_check.result
+++ b/mysql-test/r/show_check.result
@@ -15,7 +15,7 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is
def Table 253 128 7 Y 0 31 8
def Op 253 10 5 Y 0 31 8
def Msg_type 253 10 6 Y 0 31 8
-def Msg_text 253 255 27 Y 0 31 8
+def Msg_text 250 393216 27 Y 0 31 8
Table Op Msg_type Msg_text
test.t1 check status Table is already up to date
check table t1 fast;
@@ -23,7 +23,7 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is
def Table 253 128 7 Y 0 31 8
def Op 253 10 5 Y 0 31 8
def Msg_type 253 10 6 Y 0 31 8
-def Msg_text 253 255 27 Y 0 31 8
+def Msg_text 250 393216 27 Y 0 31 8
Table Op Msg_type Msg_text
test.t1 check status Table is already up to date
check table t1 changed;
@@ -31,7 +31,7 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is
def Table 253 128 7 Y 0 31 8
def Op 253 10 5 Y 0 31 8
def Msg_type 253 10 6 Y 0 31 8
-def Msg_text 253 255 2 Y 0 31 8
+def Msg_text 250 393216 2 Y 0 31 8
Table Op Msg_type Msg_text
test.t1 check status OK
insert into t1 values (5,5,5);
@@ -40,7 +40,7 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is
def Table 253 128 7 Y 0 31 8
def Op 253 10 5 Y 0 31 8
def Msg_type 253 10 6 Y 0 31 8
-def Msg_text 253 255 2 Y 0 31 8
+def Msg_text 250 393216 2 Y 0 31 8
Table Op Msg_type Msg_text
test.t1 check status OK
check table t1 medium;
@@ -48,7 +48,7 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is
def Table 253 128 7 Y 0 31 8
def Op 253 10 5 Y 0 31 8
def Msg_type 253 10 6 Y 0 31 8
-def Msg_text 253 255 2 Y 0 31 8
+def Msg_text 250 393216 2 Y 0 31 8
Table Op Msg_type Msg_text
test.t1 check status OK
check table t1 extended;
@@ -56,7 +56,7 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is
def Table 253 128 7 Y 0 31 8
def Op 253 10 5 Y 0 31 8
def Msg_type 253 10 6 Y 0 31 8
-def Msg_text 253 255 2 Y 0 31 8
+def Msg_text 250 393216 2 Y 0 31 8
Table Op Msg_type Msg_text
test.t1 check status OK
show index from t1;
@@ -88,7 +88,7 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is
def Table 253 128 7 Y 0 31 8
def Op 253 10 8 Y 0 31 8
def Msg_type 253 10 6 Y 0 31 8
-def Msg_text 253 255 2 Y 0 31 8
+def Msg_text 250 393216 2 Y 0 31 8
Table Op Msg_type Msg_text
test.t1 optimize status OK
optimize table t1;
@@ -160,7 +160,7 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is
def Table 253 128 7 Y 0 31 8
def Op 253 10 7 Y 0 31 8
def Msg_type 253 10 6 Y 0 31 8
-def Msg_text 253 255 2 Y 0 31 8
+def Msg_text 250 393216 2 Y 0 31 8
Table Op Msg_type Msg_text
test.t1 analyze status OK
show index from t1;
@@ -177,7 +177,7 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is
def Table 253 128 7 Y 0 31 8
def Op 253 10 6 Y 0 31 8
def Msg_type 253 10 6 Y 0 31 8
-def Msg_text 253 255 2 Y 0 31 8
+def Msg_text 250 393216 2 Y 0 31 8
Table Op Msg_type Msg_text
test.t1 repair status OK
show index from t1;
diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result
index c297ceda572..6e6f05667ed 100644
--- a/mysql-test/r/sp.result
+++ b/mysql-test/r/sp.result
@@ -7916,4 +7916,65 @@ DROP FUNCTION f1;
DROP FUNCTION f2;
DROP FUNCTION f3;
DROP FUNCTION f4;
+
+Stored procedures and a condition handler in a nested procedure call
+doesn't suppress the condition from being passed on to the calling
+procedure
+
+drop procedure if exists p1;
+drop procedure if exists p0;
+create table t1 (id int);
+create procedure p1 () begin
+declare i int default 0;
+declare continue handler for not found begin
+select "You should see this message and the warning that generated this" as "message";
+show warnings;
+end;
+select id into i from t1;
+end$$
+create procedure p0 () begin
+declare continue handler for not found begin
+select "You should NOT see this message" as "message";
+end;
+call p1();
+end$$
+call p0();
+message
+You should see this message and the warning that generated this
+Level Code Message
+Warning 1329 No data - zero rows fetched, selected, or processed
+Warnings:
+Warning 1329 No data - zero rows fetched, selected, or processed
+drop procedure p1;
+drop procedure p0;
+drop table t1;
+
+Test if stored procedures propagates errors
+
+create table t1 (id int primary key);
+create procedure p1 () begin
+insert into t1 values(1);
+insert into t1 values(2);
+insert into t1 values(2);
+insert into t1 values(3);
+end$$
+create procedure p2 () begin
+declare x int;
+select id into x from t1 where id=5;
+end$$
+call p1();
+ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
+show warnings;
+Level Code Message
+Error 1062 Duplicate entry '2' for key 'PRIMARY'
+select * from t1;
+id
+1
+2
+call p2();
+Warnings:
+Warning 1329 No data - zero rows fetched, selected, or processed
+drop procedure p1;
+drop procedure p2;
+drop table t1;
# End of 5.5 test
diff --git a/mysql-test/r/status_user.result b/mysql-test/r/status_user.result
index 040b2d85a51..fb6dac3f5ac 100644
--- a/mysql-test/r/status_user.result
+++ b/mysql-test/r/status_user.result
@@ -27,7 +27,7 @@ ACCESS_DENIED bigint(21) NO 0
EMPTY_QUERIES bigint(21) NO 0
show columns from information_schema.user_statistics;
Field Type Null Key Default Extra
-USER varchar(48) NO
+USER varchar(128) NO
TOTAL_CONNECTIONS int(11) NO 0
CONCURRENT_CONNECTIONS int(11) NO 0
CONNECTED_TIME int(11) NO 0
diff --git a/mysql-test/r/subselect_mat.result b/mysql-test/r/subselect_mat.result
index 53334dbc32b..0a98efb5c0e 100644
--- a/mysql-test/r/subselect_mat.result
+++ b/mysql-test/r/subselect_mat.result
@@ -1999,6 +1999,20 @@ b b v v
b b s s
b b y y
DROP TABLE t1,t2;
+#
+# MDEV-4465: Reproducible crash (mysqld got signal 11) in multi_delete::initialize_tables with semijoin+materialization
+#
+CREATE TABLE t1 (
+id int(11) NOT NULL
+);
+CREATE TABLE t2 (
+id int(11) NOT NULL,
+a_id int(11) DEFAULT NULL
+);
+insert into t1 values (1), (2), (3);
+insert into t2 values (1, 1), (2, 1), (3, 1), (4, 2), (5, 3), (6, 3), (7, 3);
+delete t2 from t2 where a_id in (select * from (select t1.id from t1 limit 2) as x);
+drop table t1,t2;
# This must be at the end:
set optimizer_switch=@subselect_sj_mat_tmp;
set join_cache_level=@save_join_cache_level;
diff --git a/mysql-test/r/subselect_sj.result b/mysql-test/r/subselect_sj.result
index 92c626eca61..56c3044c4e4 100644
--- a/mysql-test/r/subselect_sj.result
+++ b/mysql-test/r/subselect_sj.result
@@ -2852,4 +2852,36 @@ field1
o
o
DROP TABLE t1, t2;
+#
+# MDEV-389: Wrong result (missing row) with semijoin, join_cache_level>4, LEFT JOIN...
+# (testcase only)
+#
+SET join_cache_level = 5;
+SET optimizer_switch = 'semijoin=on';
+CREATE TABLE t1 (a INT NOT NULL, b CHAR(1), KEY(a)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (4,'p'),(1,'q'),(8,'e');
+CREATE TABLE t2 (c INT, d CHAR(1), KEY(c), KEY(d)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (4,'f'),(2,'i'),(5,'h'),(3,'q'),(1,'g');
+SELECT a, COUNT(*) AS cnt
+FROM t1 LEFT JOIN t2 ON (d = b)
+WHERE a IN ( SELECT c FROM t2 WHERE b > 'k' )
+GROUP BY a ORDER BY a, cnt LIMIT 2;
+a cnt
+1 1
+4 1
+drop table t1, t2;
+#
+# MDEV-4071: Valgrind warnings 'Invalid read' in subselect_engine::calc_const_tables with ...
+#
+CREATE TABLE t1 (b INT, c VARCHAR(1)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (7,'v'),(0,'s');
+CREATE TABLE t2 (a INT) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (0),(8);
+SELECT c, SUM( DISTINCT b ) AS sm FROM t1
+WHERE ( 5, 108 ) IN ( SELECT MIN(a), MAX(a) FROM t2 )
+GROUP BY b
+HAVING c <> ( SELECT MAX( c ) FROM t1 )
+ORDER BY sm;
+c sm
+DROP TABLE t1,t2;
set optimizer_switch=@subselect_sj_tmp;
diff --git a/mysql-test/r/subselect_sj2_mat.result b/mysql-test/r/subselect_sj2_mat.result
index c91ee67a717..1af507668da 100644
--- a/mysql-test/r/subselect_sj2_mat.result
+++ b/mysql-test/r/subselect_sj2_mat.result
@@ -1377,7 +1377,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 100.00 Using where
2 MATERIALIZED t3 hash_ALL NULL #hash#$hj 5 test.t2.i2 3 100.00 Using where; Using join buffer (flat, BNLH join)
Warnings:
-Note 1003 select `test`.`t1`.`i1` AS `i1` from `test`.`t1` semi join (`test`.`t2` join `test`.`t3`) where ((`test`.`t3`.`i3` = `test`.`t2`.`i2`) and (`test`.`t1`.`i1` = `test`.`t2`.`i2`) and (`test`.`t3`.`i3` > 0))
+Note 1003 select `test`.`t1`.`i1` AS `i1` from `test`.`t1` semi join (`test`.`t2` join `test`.`t3`) where ((`test`.`t3`.`i3` = `test`.`t2`.`i2`) and (`test`.`t1`.`i1` = `test`.`t2`.`i2`) and (`test`.`t2`.`i2` > 0))
SELECT * FROM t1
WHERE i1 IN (SELECT i3 FROM t2, t3 WHERE i3 > 0 AND i3 = i2 OR 1=2);
i1
diff --git a/mysql-test/r/subselect_sj_jcl6.result b/mysql-test/r/subselect_sj_jcl6.result
index 04a54c9a371..7be29201c63 100644
--- a/mysql-test/r/subselect_sj_jcl6.result
+++ b/mysql-test/r/subselect_sj_jcl6.result
@@ -2866,6 +2866,38 @@ field1
o
o
DROP TABLE t1, t2;
+#
+# MDEV-389: Wrong result (missing row) with semijoin, join_cache_level>4, LEFT JOIN...
+# (testcase only)
+#
+SET join_cache_level = 5;
+SET optimizer_switch = 'semijoin=on';
+CREATE TABLE t1 (a INT NOT NULL, b CHAR(1), KEY(a)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (4,'p'),(1,'q'),(8,'e');
+CREATE TABLE t2 (c INT, d CHAR(1), KEY(c), KEY(d)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (4,'f'),(2,'i'),(5,'h'),(3,'q'),(1,'g');
+SELECT a, COUNT(*) AS cnt
+FROM t1 LEFT JOIN t2 ON (d = b)
+WHERE a IN ( SELECT c FROM t2 WHERE b > 'k' )
+GROUP BY a ORDER BY a, cnt LIMIT 2;
+a cnt
+1 1
+4 1
+drop table t1, t2;
+#
+# MDEV-4071: Valgrind warnings 'Invalid read' in subselect_engine::calc_const_tables with ...
+#
+CREATE TABLE t1 (b INT, c VARCHAR(1)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (7,'v'),(0,'s');
+CREATE TABLE t2 (a INT) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (0),(8);
+SELECT c, SUM( DISTINCT b ) AS sm FROM t1
+WHERE ( 5, 108 ) IN ( SELECT MIN(a), MAX(a) FROM t2 )
+GROUP BY b
+HAVING c <> ( SELECT MAX( c ) FROM t1 )
+ORDER BY sm;
+c sm
+DROP TABLE t1,t2;
set optimizer_switch=@subselect_sj_tmp;
#
# BUG#49129: Wrong result with IN-subquery with join_cache_level=6 and firstmatch=off
diff --git a/mysql-test/r/subselect_sj_mat.result b/mysql-test/r/subselect_sj_mat.result
index 549282c9dbe..4e8d1697b83 100644
--- a/mysql-test/r/subselect_sj_mat.result
+++ b/mysql-test/r/subselect_sj_mat.result
@@ -2039,6 +2039,20 @@ b b v v
b b s s
b b y y
DROP TABLE t1,t2;
+#
+# MDEV-4465: Reproducible crash (mysqld got signal 11) in multi_delete::initialize_tables with semijoin+materialization
+#
+CREATE TABLE t1 (
+id int(11) NOT NULL
+);
+CREATE TABLE t2 (
+id int(11) NOT NULL,
+a_id int(11) DEFAULT NULL
+);
+insert into t1 values (1), (2), (3);
+insert into t2 values (1, 1), (2, 1), (3, 1), (4, 2), (5, 3), (6, 3), (7, 3);
+delete t2 from t2 where a_id in (select * from (select t1.id from t1 limit 2) as x);
+drop table t1,t2;
# This must be at the end:
set optimizer_switch=@subselect_sj_mat_tmp;
set join_cache_level=@save_join_cache_level;
diff --git a/mysql-test/r/type_datetime.result b/mysql-test/r/type_datetime.result
index 05cdcf7e256..d6676bbf16b 100644
--- a/mysql-test/r/type_datetime.result
+++ b/mysql-test/r/type_datetime.result
@@ -665,6 +665,22 @@ Warning 1292 Incorrect datetime value: '10:19:31'
Warning 1292 Incorrect datetime value: '22:55:23'
Warning 1292 Incorrect datetime value: '10:19:31'
drop table t1;
+#
+# Semantics of the condition <non-nullable datetime field> IS NULL
+# when the field belongs to an inner table of an outer join
+#
+create table t1 (a int, b date not null);
+insert t1 values (1, 0), (2, '1999-01-02');
+create table t2 (c int);
+insert t2 values (1),(3);
+select * from t2 left join t1 on t1.a=t2.c where t1.a is null;
+c a b
+3 NULL NULL
+select * from t2 left join t1 on t1.a=t2.c where t1.b is null;
+c a b
+1 1 0000-00-00
+3 NULL NULL
+drop table t1,t2;
End of 5.3 tests
#
# Start of 5.5 tests
diff --git a/mysql-test/r/user_var-binlog.result b/mysql-test/r/user_var-binlog.result
index 56fe19200f8..eaaf5c39ec4 100644
--- a/mysql-test/r/user_var-binlog.result
+++ b/mysql-test/r/user_var-binlog.result
@@ -9,12 +9,12 @@ insert into t1 values (@var1),(@var2);
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
-master-bin.000001 # User var # # @`a b`=_latin1 0x68656C6C6F COLLATE latin1_swedish_ci
+master-bin.000001 # User var # # @`a b`=_latin1 X'68656C6C6F' COLLATE latin1_swedish_ci
master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES(@`a b`)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
-master-bin.000001 # User var # # @`var1`=_latin1 0x273B616161 COLLATE latin1_swedish_ci
-master-bin.000001 # User var # # @`var2`=_binary 0x61 COLLATE binary
+master-bin.000001 # User var # # @`var1`=_latin1 X'273B616161' COLLATE latin1_swedish_ci
+master-bin.000001 # User var # # @`var2`=_binary X'61' COLLATE binary
master-bin.000001 # Query # # use `test`; insert into t1 values (@var1),(@var2)
master-bin.000001 # Query # # COMMIT
flush logs;
@@ -25,7 +25,7 @@ DELIMITER /*!*/;
ROLLBACK/*!*/;
BEGIN
/*!*/;
-SET @`a b`:=_latin1 0x68656C6C6F COLLATE `latin1_swedish_ci`/*!*/;
+SET @`a b`:=_latin1 X'68656C6C6F' COLLATE `latin1_swedish_ci`/*!*/;
use `test`/*!*/;
SET TIMESTAMP=10000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
@@ -43,8 +43,8 @@ COMMIT
/*!*/;
BEGIN
/*!*/;
-SET @`var1`:=_latin1 0x273B616161 COLLATE `latin1_swedish_ci`/*!*/;
-SET @`var2`:=_binary 0x61 COLLATE `binary`/*!*/;
+SET @`var1`:=_latin1 X'273B616161' COLLATE `latin1_swedish_ci`/*!*/;
+SET @`var2`:=_binary X'61' COLLATE `binary`/*!*/;
SET TIMESTAMP=10000/*!*/;
insert into t1 values (@var1),(@var2)
/*!*/;
diff --git a/mysql-test/r/varbinary.result b/mysql-test/r/varbinary.result
index 065abbb9c00..689db16b5d4 100644
--- a/mysql-test/r/varbinary.result
+++ b/mysql-test/r/varbinary.result
@@ -5,9 +5,62 @@ A 65 9223372036854775807 18446744073709551615
select 0x31+1,concat(0x31)+1,-0xf;
0x31+1 concat(0x31)+1 -0xf
50 2 -15
-select x'31',X'ffff'+0;
-x'31' X'ffff'+0
+select x'31',0xffff+0;
+x'31' 0xffff+0
1 65535
+select X'FFFF'+0;
+X'FFFF'+0
+0
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '\xFF\xFF'
+SELECT x'31'+0, 0x31+0;
+x'31'+0 0x31+0
+1 49
+SELECT x'31'+0.1e0, 0x31+0.1e0;
+x'31'+0.1e0 0x31+0.1e0
+1.1 49.1
+SELECT x'312E39'+0e0, 0x312E39+0e0;
+x'312E39'+0e0 0x312E39+0e0
+1.9 3223097
+SELECT CAST(x'31' AS SIGNED), CAST(0x31 AS SIGNED);
+CAST(x'31' AS SIGNED) CAST(0x31 AS SIGNED)
+1 49
+SELECT CAST(x'31' AS DECIMAL(10,1)), CAST(0x31 AS DECIMAL(10,1));
+CAST(x'31' AS DECIMAL(10,1)) CAST(0x31 AS DECIMAL(10,1))
+1.0 49.0
+SELECT CAST(x'312E39' AS SIGNED), CAST(0x312E39 AS SIGNED);
+CAST(x'312E39' AS SIGNED) CAST(0x312E39 AS SIGNED)
+1 3223097
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: '1.9'
+SELECT CAST(x'312E39' AS DECIMAL(10,1)), CAST(0x312E39 AS DECIMAL(10,1));
+CAST(x'312E39' AS DECIMAL(10,1)) CAST(0x312E39 AS DECIMAL(10,1))
+1.9 3223097.0
+EXPLAIN EXTENDED SELECT X'FFFF', 0xFFFF;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1003 select X'ffff' AS `X'FFFF'`,0xffff AS `0xFFFF`
+CREATE TABLE t1 (a int);
+INSERT INTO t1 VALUES (X'31'),(0x31);
+INSERT INTO t1 VALUES (X'312E39'),(0x312E39);
+SELECT * FROM t1;
+a
+1
+49
+2
+3223097
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL(10,1));
+INSERT INTO t1 VALUES (X'31'),(0x31);
+INSERT INTO t1 VALUES (X'312E39'),(0x312E39);
+SELECT * FROM t1;
+a
+1.0
+49.0
+1.9
+3223097.0
+DROP TABLE t1;
create table t1 (ID int(8) unsigned zerofill not null auto_increment,UNIQ bigint(21) unsigned zerofill not null,primary key (ID),unique (UNIQ) );
insert into t1 set UNIQ=0x38afba1d73e6a18a;
insert into t1 set UNIQ=123;
@@ -104,8 +157,8 @@ A
select b'01000001';
b'01000001'
A
-select x'41', 0+x'41';
-x'41' 0+x'41'
+select x'41', 0+x'3635';
+x'41' 0+x'3635'
A 65
select N'abc', length(N'abc');
abc length(N'abc')
diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result
index f280fce08d3..817c725f131 100644
--- a/mysql-test/r/variables.result
+++ b/mysql-test/r/variables.result
@@ -78,7 +78,7 @@ explain extended select @t1:=(@t2:=1)+@t3:=4,@t1,@t2,@t3;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select (@t1:=((@t2:=1) + (@t3:=4))) AS `@t1:=(@t2:=1)+@t3:=4`,(@t1) AS `@t1`,(@t2) AS `@t2`,(@t3) AS `@t3`
+Note 1003 select (@t1:=((@t2:=1) + (@t3:=4))) AS `@t1:=(@t2:=1)+@t3:=4`,(@`t1`) AS `@t1`,(@`t2`) AS `@t2`,(@`t3`) AS `@t3`
select @t5;
@t5
1.23456
@@ -1786,4 +1786,8 @@ set session collation_connection=2048;
ERROR HY000: Unknown collation: '2048'
set session collation_database=2048;
ERROR HY000: Unknown collation: '2048'
+set session rand_seed1=DEFAULT;
+ERROR 42000: Variable 'rand_seed1' doesn't have a default value
+set autocommit = values(v);
+ERROR 42S22: Unknown column 'v' in 'field list'
End of 5.5 tests