Skip to content

Commit

Permalink
Merge 10.5 into 10.6
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-m committed Jan 25, 2021
2 parents 0d7380f + 961c793 commit 46234f0
Show file tree
Hide file tree
Showing 83 changed files with 1,420 additions and 337 deletions.
14 changes: 14 additions & 0 deletions mysql-test/main/alter_events.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
SET GLOBAL event_scheduler=1;
CREATE TABLE t1 (a int primary key, b int) engine=innodb;
insert into t1 values (1,1),(2,2),(3,3);
CREATE TABLE t2 (a int primary key) engine=innodb;
CREATE EVENT e_t1 ON SCHEDULE EVERY 1 SECOND DO insert ignore into test.t2 select a from test.t1;
select * from t2;
a
1
2
3
drop event e_t1;
ALTER TABLE mysql.event DROP PRIMARY KEY, ADD PRIMARY KEY(db,name);
drop table t1,t2;
SET GLOBAL event_scheduler=default;
31 changes: 31 additions & 0 deletions mysql-test/main/alter_events.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
--source include/not_embedded.inc
--source include/have_innodb.inc
#--source include/have_metadata_lock_info.inc

#
# Testing of problems with ALTER TABLE and events on the same table(s)
#

#
# MDEV-24452 ALTER TABLE event take infinite time which for example breaks
# mysql_upgrade
#

SET GLOBAL event_scheduler=1;

CREATE TABLE t1 (a int primary key, b int) engine=innodb;
insert into t1 values (1,1),(2,2),(3,3);
CREATE TABLE t2 (a int primary key) engine=innodb;

CREATE EVENT e_t1 ON SCHEDULE EVERY 1 SECOND DO insert ignore into test.t2 select a from test.t1;

let $wait_condition=SELECT count(*) > 0 from t2;
--source include/wait_condition.inc
select * from t2;
drop event e_t1;

# select * from information_schema.metadata_lock_info;
ALTER TABLE mysql.event DROP PRIMARY KEY, ADD PRIMARY KEY(db,name);
drop table t1,t2;

SET GLOBAL event_scheduler=default;
72 changes: 72 additions & 0 deletions mysql-test/main/derived_cond_pushdown.result
Original file line number Diff line number Diff line change
Expand Up @@ -17034,6 +17034,78 @@ id
2
3
DROP TABLE t;
#
# MDEV-23804: Server crashes in st_select_lex::collect_grouping_fields_for_derived
#
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (3),(4);
CREATE VIEW v1 AS SELECT a FROM t1 UNION VALUES (3),(4);
ANALYZE FORMAT=JSON SELECT * from v1 WHERE a=3;
ANALYZE
{
"query_block": {
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"table": {
"table_name": "<derived2>",
"access_type": "ALL",
"r_loops": 1,
"rows": 4,
"r_rows": 2,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 50,
"attached_condition": "v1.a = 3",
"materialized": {
"query_block": {
"union_result": {
"table_name": "<union2,3>",
"access_type": "ALL",
"r_loops": 1,
"r_rows": 2,
"query_specifications": [
{
"query_block": {
"select_id": 2,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"table": {
"table_name": "t1",
"access_type": "ALL",
"r_loops": 1,
"rows": 2,
"r_rows": 2,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 50,
"attached_condition": "t1.a = 3"
}
}
},
{
"query_block": {
"select_id": 3,
"operation": "UNION",
"table": {
"message": "No tables used"
}
}
}
]
}
}
}
}
}
}
SELECT * from v1 WHERE a=3;
a
3
DROP VIEW v1;
DROP TABLE t1;
# End of 10.3 tests
#
# MDEV-18679: materialized view with SELECT S containing materialized
Expand Down
13 changes: 13 additions & 0 deletions mysql-test/main/derived_cond_pushdown.test
Original file line number Diff line number Diff line change
Expand Up @@ -3466,6 +3466,19 @@ eval set statement optimizer_switch='split_materialized=on' for $q;

DROP TABLE t;

--echo #
--echo # MDEV-23804: Server crashes in st_select_lex::collect_grouping_fields_for_derived
--echo #

CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (3),(4);
CREATE VIEW v1 AS SELECT a FROM t1 UNION VALUES (3),(4);
--source include/analyze-format.inc
ANALYZE FORMAT=JSON SELECT * from v1 WHERE a=3;
SELECT * from v1 WHERE a=3;
DROP VIEW v1;
DROP TABLE t1;

--echo # End of 10.3 tests

--echo #
Expand Down
29 changes: 29 additions & 0 deletions mysql-test/main/empty_string_literal.result
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,32 @@ 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 NULL AS `NULL`
#
# MDEV-20763 Table corruption or Assertion `btr_validate_index(index, 0, false)' failed in row_upd_sec_index_entry with virtual column and EMPTY_STRING_IS_NULL SQL mode
#
create table t1 (a int, b binary(1) generated always as (''), key(a,b));
insert into t1 (a) values (1);
set sql_mode= default;
flush tables;
update t1 set a = 2;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` binary(1) GENERATED ALWAYS AS (NULL) VIRTUAL,
KEY `a` (`a`,`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a int, b binary(1) generated always as (''), key(a,b));
insert into t1 (a) values (1);
set sql_mode= 'empty_string_is_null';
flush tables;
update t1 set a = 2;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` binary(1) GENERATED ALWAYS AS ('') VIRTUAL,
KEY `a` (`a`,`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
19 changes: 19 additions & 0 deletions mysql-test/main/empty_string_literal.test
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,22 @@ USE test;
set @mode='EMPTY_STRING_IS_NULL';

--source include/empty_string_literal.inc

--echo #
--echo # MDEV-20763 Table corruption or Assertion `btr_validate_index(index, 0, false)' failed in row_upd_sec_index_entry with virtual column and EMPTY_STRING_IS_NULL SQL mode
--echo #
create table t1 (a int, b binary(1) generated always as (''), key(a,b));
insert into t1 (a) values (1);
set sql_mode= default;
flush tables;
update t1 set a = 2;
show create table t1;
drop table t1;

create table t1 (a int, b binary(1) generated always as (''), key(a,b));
insert into t1 (a) values (1);
set sql_mode= 'empty_string_is_null';
flush tables;
update t1 set a = 2;
show create table t1;
drop table t1;
9 changes: 9 additions & 0 deletions mysql-test/main/information_schema.result
Original file line number Diff line number Diff line change
Expand Up @@ -2304,5 +2304,14 @@ create table t2 (n int);
insert into t1 set n = (select table_rows from information_schema.tables where table_name='t2');
drop table t1, t2;
#
# MDEV-24593 Signal 11 when group by primary key of table joined to information_schema.columns
#
create table t1 (f varchar(64) primary key);
select f from information_schema.columns i
inner join t1 on f=i.column_name
group by f;
f
drop table t1;
#
# End of 10.3 tests
#
10 changes: 10 additions & 0 deletions mysql-test/main/information_schema.test
Original file line number Diff line number Diff line change
Expand Up @@ -2005,6 +2005,16 @@ create table t2 (n int);
insert into t1 set n = (select table_rows from information_schema.tables where table_name='t2');
drop table t1, t2;


--echo #
--echo # MDEV-24593 Signal 11 when group by primary key of table joined to information_schema.columns
--echo #
create table t1 (f varchar(64) primary key);
select f from information_schema.columns i
inner join t1 on f=i.column_name
group by f;
drop table t1;

--echo #
--echo # End of 10.3 tests
--echo #
9 changes: 9 additions & 0 deletions mysql-test/main/parser.result
Original file line number Diff line number Diff line change
Expand Up @@ -1825,6 +1825,15 @@ EXECUTE IMMEDIATE 'if(`systeminfo /FO LIST';
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '`systeminfo /FO LIST' at line 1
EXECUTE IMMEDIATE 'if(`systeminfo';
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '`systeminfo' at line 1
#
# MDEV-23666 Assertion failed in Lex_input_stream::body_utf8_append
#
SET @@sql_mode='ANSI_QUOTES';
EXECUTE IMMEDIATE 'CREATE PROCEDURE p() UPDATE t SET c=\'\'"';
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '"' at line 1
EXECUTE IMMEDIATE 'CREATE PROCEDURE p() UPDATE t SET c=\'\'"abc';
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '"abc' at line 1
SET @@sql_mode=@save_sql_mode;
# End of 10.3 tests
#
# MDEV-19540: 10.4 allow lock options with SELECT in brackets
Expand Down
15 changes: 15 additions & 0 deletions mysql-test/main/parser.test
Original file line number Diff line number Diff line change
Expand Up @@ -1566,6 +1566,21 @@ EXECUTE IMMEDIATE 'if(`systeminfo /FO LIST';
--error ER_PARSE_ERROR
EXECUTE IMMEDIATE 'if(`systeminfo';

--echo #
--echo # MDEV-23666 Assertion failed in Lex_input_stream::body_utf8_append
--echo #
SET @@sql_mode='ANSI_QUOTES';

# Without a patch execution of the following statements results in assertion
# in Lex_input_stream::body_utf8_append on parsing the statement
--error ER_PARSE_ERROR
EXECUTE IMMEDIATE 'CREATE PROCEDURE p() UPDATE t SET c=\'\'"';

--error ER_PARSE_ERROR
EXECUTE IMMEDIATE 'CREATE PROCEDURE p() UPDATE t SET c=\'\'"abc';

SET @@sql_mode=@save_sql_mode;

--echo # End of 10.3 tests

--echo #
Expand Down
16 changes: 10 additions & 6 deletions mysql-test/main/processlist_notembedded.result
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# MDEV-20466: SHOW PROCESSLIST truncates query text on \0 bytes
#
connect con1,localhost,root,,;
connect con1,localhost,root;
connection con1;
SET DEBUG_SYNC= 'before_join_optimize SIGNAL in_sync WAIT_FOR go';
connection default;
Expand All @@ -13,17 +13,21 @@ User
disconnect con1;
connection default;
SET DEBUG_SYNC = 'RESET';
End of 5.5 tests
#
# End of 5.5 tests
#
#
# MDEV-23752: SHOW EXPLAIN FOR thd waits for sleep
#
connect con1,localhost,root,,;
select sleep(100000);;
connect con1,localhost,root;
select sleep(100000);
connection default;
SHOW EXPLAIN FOR con_id;
SHOW EXPLAIN FOR $con_id;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select sleep(100000)
KILL QUERY con_id;
KILL QUERY $con_id;
#
# End of 10.2 tests
#
20 changes: 10 additions & 10 deletions mysql-test/main/processlist_notembedded.test
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ source include/count_sessions.inc;
--echo # MDEV-20466: SHOW PROCESSLIST truncates query text on \0 bytes
--echo #

connect (con1,localhost,root,,);
connect con1,localhost,root;

connection con1;

Expand Down Expand Up @@ -39,22 +39,22 @@ SET DEBUG_SYNC = 'RESET';

source include/wait_until_count_sessions.inc;

--echo End of 5.5 tests
--echo #
--echo # End of 5.5 tests
--echo #

--echo #
--echo # MDEV-23752: SHOW EXPLAIN FOR thd waits for sleep
--echo #

--connect (con1,localhost,root,,)
--connect con1,localhost,root
--let $con_id = `SELECT CONNECTION_ID()`
--send select sleep(100000);
--send select sleep(100000)

--connection default
evalp SHOW EXPLAIN FOR $con_id;
evalp KILL QUERY $con_id;

--replace_result $con_id con_id
eval SHOW EXPLAIN FOR $con_id;

--replace_result $con_id con_id
eval KILL QUERY $con_id;

--echo #
--echo # End of 10.2 tests
--echo #
11 changes: 10 additions & 1 deletion mysql-test/main/sp-ucs2.result
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ RETURN 'str';
END|
ERROR 42000: COLLATION 'ucs2_unicode_ci' is not valid for CHARACTER SET 'latin1'
SET NAMES utf8;
DROP FUNCTION IF EXISTS bug48766;
CREATE FUNCTION bug48766 ()
RETURNS ENUM( 'w' ) CHARACTER SET ucs2
RETURN 0;
Expand All @@ -140,3 +139,13 @@ WHERE ROUTINE_NAME='bug48766';
DTD_IDENTIFIER
enum('а','б','в','г')
DROP FUNCTION bug48766;
call mtr.add_suppression('invalid value in column mysql.proc.');
set collation_connection=ucs2_general_ci;
insert into mysql.proc (db, name, type, specific_name, language, sql_data_access, is_deterministic, security_type, param_list, returns, body, definer, created, modified, sql_mode, comment, character_set_client, collation_connection, db_collation, body_utf8 ) values ( 'a', 'a', 'function', 'bug14233_1', 'sql', 'reads_sql_data', 'no', 'definer', '', 'int(10)', 'select * from mysql.user', 'root@localhost', now(), '0000-00-00 00:00:00', '', '', '', '', '', 'select * from mysql.user' );
select routine_name from information_schema.routines where routine_name='a';
routine_name
a
Warnings:
Warning 1601 Creation context of stored routine `a`.`a` is invalid
set collation_connection=default;
delete from mysql.proc where name='a';
13 changes: 10 additions & 3 deletions mysql-test/main/sp-ucs2.test
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,6 @@ delimiter ;|
# Bug#48766 SHOW CREATE FUNCTION returns extra data in return clause
#
SET NAMES utf8;
--disable_warnings
DROP FUNCTION IF EXISTS bug48766;
--enable_warnings
#
# Test that Latin letters are not prepended with extra '\0'.
#
Expand All @@ -175,3 +172,13 @@ SELECT DTD_IDENTIFIER FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_NAME='bug48766';

DROP FUNCTION bug48766;

#
#
#
call mtr.add_suppression('invalid value in column mysql.proc.');
set collation_connection=ucs2_general_ci;
insert into mysql.proc (db, name, type, specific_name, language, sql_data_access, is_deterministic, security_type, param_list, returns, body, definer, created, modified, sql_mode, comment, character_set_client, collation_connection, db_collation, body_utf8 ) values ( 'a', 'a', 'function', 'bug14233_1', 'sql', 'reads_sql_data', 'no', 'definer', '', 'int(10)', 'select * from mysql.user', 'root@localhost', now(), '0000-00-00 00:00:00', '', '', '', '', '', 'select * from mysql.user' );
select routine_name from information_schema.routines where routine_name='a';
set collation_connection=default;
delete from mysql.proc where name='a';
Loading

0 comments on commit 46234f0

Please sign in to comment.