diff options
Diffstat (limited to 'mysql-test/main')
34 files changed, 507 insertions, 65 deletions
diff --git a/mysql-test/main/analyze_stmt.result b/mysql-test/main/analyze_stmt.result index c3c98593210..3ae49c5eeb6 100644 --- a/mysql-test/main/analyze_stmt.result +++ b/mysql-test/main/analyze_stmt.result @@ -247,7 +247,7 @@ drop table t1; # create table t1 (i int); insert into t1 values (1); -analyze select * from t1 into @var; +analyze select * into @var from t1 ; id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra 1 SIMPLE t1 system NULL NULL NULL NULL 1 NULL 100.00 NULL drop table t1; @@ -281,10 +281,10 @@ drop table t1; # create table t1(a int); insert into t1 values (1),(2); -analyze select a from t1 where a <2 into @var; +analyze select a into @var from t1 where a <2 ; id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 2.00 100.00 50.00 Using where -analyze select a from t1 into @var; +analyze select a into @var from t1 ; ERROR 42000: Result consisted of more than one row analyze insert into t1 select * from t1; id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra diff --git a/mysql-test/main/analyze_stmt.test b/mysql-test/main/analyze_stmt.test index d02139fe0c8..15fc00a321d 100644 --- a/mysql-test/main/analyze_stmt.test +++ b/mysql-test/main/analyze_stmt.test @@ -196,7 +196,7 @@ drop table t1; --echo # create table t1 (i int); insert into t1 values (1); -analyze select * from t1 into @var; +analyze select * into @var from t1 ; drop table t1; --echo # @@ -223,9 +223,9 @@ drop table t1; create table t1(a int); insert into t1 values (1),(2); -analyze select a from t1 where a <2 into @var; +analyze select a into @var from t1 where a <2 ; --error ER_TOO_MANY_ROWS -analyze select a from t1 into @var; +analyze select a into @var from t1 ; analyze insert into t1 select * from t1; diff --git a/mysql-test/main/func_time.result b/mysql-test/main/func_time.result index 9a60f3e2718..51f882aeafc 100644 --- a/mysql-test/main/func_time.result +++ b/mysql-test/main/func_time.result @@ -3421,6 +3421,36 @@ t2 CREATE TABLE `t2` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1,t2; # +# MDEV-14926 AddressSanitizer: heap-use-after-free in make_date_time on weird combination of functions +# +DO INET_ATON( FROM_UNIXTIME( @@timestamp, ( TRIM( UNHEX(HEX('%m.%d.%Y') ) ) ) ) ); +CREATE TABLE t1 (d DATE); +INSERT INTO t1 VALUES ('1989-03-10'); +SELECT TIME_FORMAT('23:59:43', BINARY d) AS f FROM t1 GROUP BY 'foo'; +f +1989-03-10 +DROP TABLE t1; +CREATE TABLE t1 (d DATE) ENGINE=MyISAM; +INSERT INTO t1 VALUES ('1900-01-01'); +SELECT LENGTH( DATE_FORMAT( d, BINARY DATABASE() ) ) AS f FROM t1 GROUP BY d; +f +4 +DROP TABLE t1; +# +# MDEV-18667 ASAN heap-use-after-free in make_date_time / Arg_comparator::compare_string / Item_func_nullif::compare +# +SELECT NULLIF('foo', FROM_UNIXTIME('2012-12-12 12:12:12', TRIM(0))); +NULLIF('foo', FROM_UNIXTIME('2012-12-12 12:12:12', TRIM(0))) +foo +Warnings: +Warning 1292 Truncated incorrect DECIMAL value: '2012-12-12 12:12:12' +# +# MDEV-18626 ASAN stack-buffer-overflow in int10_to_str / make_date_time upon DATE_FORMAT +# +SELECT DATE_FORMAT(100000000000, '%j'); +DATE_FORMAT(100000000000, '%j') +NULL +# # End of 10.1 tests # # diff --git a/mysql-test/main/func_time.test b/mysql-test/main/func_time.test index be203c99c69..232cb16939e 100644 --- a/mysql-test/main/func_time.test +++ b/mysql-test/main/func_time.test @@ -1907,6 +1907,36 @@ SELECT * FROM t2; SHOW CREATE TABLE t2; DROP TABLE t1,t2; + +--echo # +--echo # MDEV-14926 AddressSanitizer: heap-use-after-free in make_date_time on weird combination of functions +--echo # + +DO INET_ATON( FROM_UNIXTIME( @@timestamp, ( TRIM( UNHEX(HEX('%m.%d.%Y') ) ) ) ) ); + +CREATE TABLE t1 (d DATE); +INSERT INTO t1 VALUES ('1989-03-10'); +SELECT TIME_FORMAT('23:59:43', BINARY d) AS f FROM t1 GROUP BY 'foo'; +DROP TABLE t1; + +CREATE TABLE t1 (d DATE) ENGINE=MyISAM; +INSERT INTO t1 VALUES ('1900-01-01'); +SELECT LENGTH( DATE_FORMAT( d, BINARY DATABASE() ) ) AS f FROM t1 GROUP BY d; +DROP TABLE t1; + +--echo # +--echo # MDEV-18667 ASAN heap-use-after-free in make_date_time / Arg_comparator::compare_string / Item_func_nullif::compare +--echo # + +SELECT NULLIF('foo', FROM_UNIXTIME('2012-12-12 12:12:12', TRIM(0))); + +--echo # +--echo # MDEV-18626 ASAN stack-buffer-overflow in int10_to_str / make_date_time upon DATE_FORMAT +--echo # + +SELECT DATE_FORMAT(100000000000, '%j'); + + --echo # --echo # End of 10.1 tests --echo # diff --git a/mysql-test/main/kill_processlist-6619.test b/mysql-test/main/kill_processlist-6619.test index d984924f9db..c272e68a877 100644 --- a/mysql-test/main/kill_processlist-6619.test +++ b/mysql-test/main/kill_processlist-6619.test @@ -6,6 +6,7 @@ --connect (con1,localhost,root,,) --let $con_id = `SELECT CONNECTION_ID()` +--replace_result Execute Query --replace_column 1 # 3 # 6 # 7 # SHOW PROCESSLIST; SET DEBUG_SYNC='before_execute_sql_command SIGNAL ready WAIT_FOR go'; @@ -29,5 +30,6 @@ let $wait_condition= WHERE info is NULL; --source include/wait_condition.inc +--replace_result Execute Query --replace_column 1 # 3 # 6 # 7 # SHOW PROCESSLIST; diff --git a/mysql-test/main/log_slow_debug.result b/mysql-test/main/log_slow_debug.result new file mode 100644 index 00000000000..7265346b36c --- /dev/null +++ b/mysql-test/main/log_slow_debug.result @@ -0,0 +1,142 @@ +SET @org_slow_query_log= @@global.slow_query_log; +SET @org_log_output= @@global.log_output; +SET @org_log_slow_admin_statements= @@global.log_slow_admin_statements; +SET @@GLOBAL.slow_query_log=OFF; +SET @@GLOBAL.log_output='TABLE'; +FLUSH SLOW LOGS; +SET @@GLOBAL.slow_query_log=ON; +SET @@GLOBAL.log_slow_admin_statements=ON; +SET SESSION debug_dbug="+d,simulate_slow_query"; +CREATE PROCEDURE show_slow_log() +BEGIN +SELECT CONCAT('[slow] ', sql_text) AS sql_text +FROM mysql.slow_log +WHERE sql_text NOT LIKE '%debug_dbug%'; +END +$$ +# +# Expect all admin statements in the slow log (ON,DEFAULT) +# +SET @@GLOBAL.log_slow_admin_statements=ON; +SET log_slow_filter=DEFAULT; +TRUNCATE TABLE mysql.slow_log; +CREATE TABLE t1 (a INT); +CREATE INDEX t1a ON t1 (a); +DROP INDEX t1a ON t1; +DROP TABLE t1; +CREATE TABLE t2 (a INT); +ALTER TABLE t2 RENAME t2; +RENAME TABLE t2 TO t3; +DROP TABLE t3; +CREATE TABLE t4 (a INT); +PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1'; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +DROP TABLE t4; +CALL show_slow_log(); +sql_text +[slow] TRUNCATE TABLE mysql.slow_log +[slow] CREATE TABLE t1 (a INT) +[slow] CREATE INDEX t1a ON t1 (a) +[slow] DROP INDEX t1a ON t1 +[slow] DROP TABLE t1 +[slow] CREATE TABLE t2 (a INT) +[slow] ALTER TABLE t2 RENAME t2 +[slow] RENAME TABLE t2 TO t3 +[slow] DROP TABLE t3 +[slow] CREATE TABLE t4 (a INT) +[slow] PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1' +[slow] ALTER TABLE t4 MODIFY a INT DEFAULT 1 +[slow] DEALLOCATE PREPARE stmt +[slow] DROP TABLE t4 +# +# Expect all admin statements in the slow log (ON,admin) +# +SET @@GLOBAL.log_slow_admin_statements=ON; +SET log_slow_filter=admin; +TRUNCATE TABLE mysql.slow_log; +CREATE TABLE t1 (a INT); +CREATE INDEX t1a ON t1 (a); +DROP INDEX t1a ON t1; +DROP TABLE t1; +CREATE TABLE t2 (a INT); +ALTER TABLE t2 RENAME t2; +RENAME TABLE t2 TO t3; +DROP TABLE t3; +CREATE TABLE t4 (a INT); +PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1'; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +DROP TABLE t4; +CALL show_slow_log(); +sql_text +[slow] CREATE INDEX t1a ON t1 (a) +[slow] DROP INDEX t1a ON t1 +[slow] ALTER TABLE t2 RENAME t2 +[slow] RENAME TABLE t2 TO t3 +[slow] ALTER TABLE t4 MODIFY a INT DEFAULT 1 +# +# Expect none of admin DDL statements in the slow log (ON,filesort) +# +SET @@GLOBAL.log_slow_admin_statements=ON; +SET log_slow_filter=filesort; +TRUNCATE TABLE mysql.slow_log; +CREATE TABLE t1 (a INT); +CREATE INDEX t1a ON t1 (a); +DROP INDEX t1a ON t1; +DROP TABLE t1; +CREATE TABLE t2 (a INT); +ALTER TABLE t2 RENAME t2; +RENAME TABLE t2 TO t3; +DROP TABLE t3; +CREATE TABLE t4 (a INT); +PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1'; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +DROP TABLE t4; +CALL show_slow_log(); +sql_text +# +# Expect none of admin statements in the slow log (OFF,DEFAULT) +# +SET @@GLOBAL.log_slow_admin_statements=OFF; +SET log_slow_filter=DEFAULT; +TRUNCATE TABLE mysql.slow_log; +CREATE TABLE t1 (a INT); +CREATE INDEX t1a ON t1 (a); +DROP INDEX t1a ON t1; +DROP TABLE t1; +CREATE TABLE t2 (a INT); +ALTER TABLE t2 RENAME t2; +RENAME TABLE t2 TO t3; +DROP TABLE t3; +CREATE TABLE t4 (a INT); +PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1'; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +DROP TABLE t4; +CALL show_slow_log(); +sql_text +[slow] TRUNCATE TABLE mysql.slow_log +[slow] CREATE TABLE t1 (a INT) +[slow] CREATE INDEX t1a ON t1 (a) +[slow] DROP INDEX t1a ON t1 +[slow] DROP TABLE t1 +[slow] CREATE TABLE t2 (a INT) +[slow] ALTER TABLE t2 RENAME t2 +[slow] RENAME TABLE t2 TO t3 +[slow] DROP TABLE t3 +[slow] CREATE TABLE t4 (a INT) +[slow] PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1' +[slow] ALTER TABLE t4 MODIFY a INT DEFAULT 1 +[slow] DEALLOCATE PREPARE stmt +[slow] DROP TABLE t4 +# +# Clean up +# +SET SESSION debug_dbug="-d,simulate_slow_query"; +TRUNCATE mysql.slow_log; +SET @@global.slow_query_log= @org_slow_query_log; +SET @@global.log_output= @org_log_output; +SET @@global.log_slow_admin_statements= @org_log_slow_admin_statements; +DROP PROCEDURE show_slow_log; diff --git a/mysql-test/main/log_slow_debug.test b/mysql-test/main/log_slow_debug.test new file mode 100644 index 00000000000..35b5b93423d --- /dev/null +++ b/mysql-test/main/log_slow_debug.test @@ -0,0 +1,126 @@ +-- source include/have_debug.inc + +SET @org_slow_query_log= @@global.slow_query_log; +SET @org_log_output= @@global.log_output; +SET @org_log_slow_admin_statements= @@global.log_slow_admin_statements; + +SET @@GLOBAL.slow_query_log=OFF; +SET @@GLOBAL.log_output='TABLE'; +FLUSH SLOW LOGS; +SET @@GLOBAL.slow_query_log=ON; +SET @@GLOBAL.log_slow_admin_statements=ON; +SET SESSION debug_dbug="+d,simulate_slow_query"; + +DELIMITER $$; +CREATE PROCEDURE show_slow_log() +BEGIN + SELECT CONCAT('[slow] ', sql_text) AS sql_text + FROM mysql.slow_log + WHERE sql_text NOT LIKE '%debug_dbug%'; +END +$$ +DELIMITER ;$$ + + +--echo # +--echo # Expect all admin statements in the slow log (ON,DEFAULT) +--echo # + +SET @@GLOBAL.log_slow_admin_statements=ON; +SET log_slow_filter=DEFAULT; +TRUNCATE TABLE mysql.slow_log; +CREATE TABLE t1 (a INT); +CREATE INDEX t1a ON t1 (a); +DROP INDEX t1a ON t1; +DROP TABLE t1; +CREATE TABLE t2 (a INT); +ALTER TABLE t2 RENAME t2; +RENAME TABLE t2 TO t3; +DROP TABLE t3; +CREATE TABLE t4 (a INT); +PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1'; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +DROP TABLE t4; +CALL show_slow_log(); + + +--echo # +--echo # Expect all admin statements in the slow log (ON,admin) +--echo # + +SET @@GLOBAL.log_slow_admin_statements=ON; +SET log_slow_filter=admin; +TRUNCATE TABLE mysql.slow_log; +CREATE TABLE t1 (a INT); +CREATE INDEX t1a ON t1 (a); +DROP INDEX t1a ON t1; +DROP TABLE t1; +CREATE TABLE t2 (a INT); +ALTER TABLE t2 RENAME t2; +RENAME TABLE t2 TO t3; +DROP TABLE t3; +CREATE TABLE t4 (a INT); +PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1'; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +DROP TABLE t4; +CALL show_slow_log(); + + +--echo # +--echo # Expect none of admin DDL statements in the slow log (ON,filesort) +--echo # + +SET @@GLOBAL.log_slow_admin_statements=ON; +SET log_slow_filter=filesort; +TRUNCATE TABLE mysql.slow_log; +CREATE TABLE t1 (a INT); +CREATE INDEX t1a ON t1 (a); +DROP INDEX t1a ON t1; +DROP TABLE t1; +CREATE TABLE t2 (a INT); +ALTER TABLE t2 RENAME t2; +RENAME TABLE t2 TO t3; +DROP TABLE t3; +CREATE TABLE t4 (a INT); +PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1'; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +DROP TABLE t4; +CALL show_slow_log(); + + +--echo # +--echo # Expect none of admin statements in the slow log (OFF,DEFAULT) +--echo # + +SET @@GLOBAL.log_slow_admin_statements=OFF; +SET log_slow_filter=DEFAULT; +TRUNCATE TABLE mysql.slow_log; +CREATE TABLE t1 (a INT); +CREATE INDEX t1a ON t1 (a); +DROP INDEX t1a ON t1; +DROP TABLE t1; +CREATE TABLE t2 (a INT); +ALTER TABLE t2 RENAME t2; +RENAME TABLE t2 TO t3; +DROP TABLE t3; +CREATE TABLE t4 (a INT); +PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1'; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +DROP TABLE t4; +CALL show_slow_log(); + + +--echo # +--echo # Clean up +--echo # + +SET SESSION debug_dbug="-d,simulate_slow_query"; +TRUNCATE mysql.slow_log; +SET @@global.slow_query_log= @org_slow_query_log; +SET @@global.log_output= @org_log_output; +SET @@global.log_slow_admin_statements= @org_log_slow_admin_statements; +DROP PROCEDURE show_slow_log; diff --git a/mysql-test/main/log_tables.test b/mysql-test/main/log_tables.test index a4158ba6a24..f822ec8d758 100644 --- a/mysql-test/main/log_tables.test +++ b/mysql-test/main/log_tables.test @@ -855,7 +855,9 @@ SET GLOBAL slow_query_log = @old_slow_query_log; # select CONNECTION_ID() into @thread_id; +--disable_ps_protocol truncate table mysql.general_log; +--enable_ps_protocol set global general_log = on; --disable_result_log set @lparam = "000 001 002 003 004 005 006 007 008 009" diff --git a/mysql-test/main/mysql_client_test.result b/mysql-test/main/mysql_client_test.result index 6f65979517b..6ecf03946ab 100644 --- a/mysql-test/main/mysql_client_test.result +++ b/mysql-test/main/mysql_client_test.result @@ -149,7 +149,7 @@ ANALYZE number of fields: 13 - 6: name: 'key_len'/''; table: ''/''; db: ''; catalog: 'def'; length: 12288; max_length: 0; type: 253; decimals: 39 - 7: name: 'ref'/''; table: ''/''; db: ''; catalog: 'def'; length: 6144; max_length: 0; type: 253; decimals: 39 - 8: name: 'rows'/''; table: ''/''; db: ''; catalog: 'def'; length: 10; max_length: 0; type: 8; decimals: 0 - - 9: name: 'r_rows'/''; table: ''/''; db: ''; catalog: 'def'; length: 4; max_length: 0; type: 5; decimals: 10 + - 9: name: 'r_rows'/''; table: ''/''; db: ''; catalog: 'def'; length: 4; max_length: 0; type: 5; decimals: 2 - 10: name: 'filtered'/''; table: ''/''; db: ''; catalog: 'def'; length: 4; max_length: 0; type: 5; decimals: 2 - 11: name: 'r_filtered'/''; table: ''/''; db: ''; catalog: 'def'; length: 4; max_length: 0; type: 5; decimals: 2 - 12: name: 'Extra'/''; table: ''/''; db: ''; catalog: 'def'; length: 765; max_length: 0; type: 253; decimals: 39 @@ -178,7 +178,7 @@ ANALYZE INSERT number of fields: 13 - 6: name: 'key_len'/''; table: ''/''; db: ''; catalog: 'def'; length: 12288; max_length: 0; type: 253; decimals: 39 - 7: name: 'ref'/''; table: ''/''; db: ''; catalog: 'def'; length: 6144; max_length: 0; type: 253; decimals: 39 - 8: name: 'rows'/''; table: ''/''; db: ''; catalog: 'def'; length: 10; max_length: 0; type: 8; decimals: 0 - - 9: name: 'r_rows'/''; table: ''/''; db: ''; catalog: 'def'; length: 4; max_length: 0; type: 5; decimals: 10 + - 9: name: 'r_rows'/''; table: ''/''; db: ''; catalog: 'def'; length: 4; max_length: 0; type: 5; decimals: 2 - 10: name: 'filtered'/''; table: ''/''; db: ''; catalog: 'def'; length: 4; max_length: 0; type: 5; decimals: 2 - 11: name: 'r_filtered'/''; table: ''/''; db: ''; catalog: 'def'; length: 4; max_length: 0; type: 5; decimals: 2 - 12: name: 'Extra'/''; table: ''/''; db: ''; catalog: 'def'; length: 765; max_length: 0; type: 253; decimals: 39 @@ -207,7 +207,7 @@ ANALYZE UPDATE number of fields: 13 - 6: name: 'key_len'/''; table: ''/''; db: ''; catalog: 'def'; length: 12288; max_length: 0; type: 253; decimals: 39 - 7: name: 'ref'/''; table: ''/''; db: ''; catalog: 'def'; length: 6144; max_length: 0; type: 253; decimals: 39 - 8: name: 'rows'/''; table: ''/''; db: ''; catalog: 'def'; length: 10; max_length: 0; type: 8; decimals: 0 - - 9: name: 'r_rows'/''; table: ''/''; db: ''; catalog: 'def'; length: 4; max_length: 0; type: 5; decimals: 10 + - 9: name: 'r_rows'/''; table: ''/''; db: ''; catalog: 'def'; length: 4; max_length: 0; type: 5; decimals: 2 - 10: name: 'filtered'/''; table: ''/''; db: ''; catalog: 'def'; length: 4; max_length: 0; type: 5; decimals: 2 - 11: name: 'r_filtered'/''; table: ''/''; db: ''; catalog: 'def'; length: 4; max_length: 0; type: 5; decimals: 2 - 12: name: 'Extra'/''; table: ''/''; db: ''; catalog: 'def'; length: 765; max_length: 0; type: 253; decimals: 39 @@ -236,7 +236,7 @@ ANALYZE DELETE number of fields: 13 - 6: name: 'key_len'/''; table: ''/''; db: ''; catalog: 'def'; length: 12288; max_length: 0; type: 253; decimals: 39 - 7: name: 'ref'/''; table: ''/''; db: ''; catalog: 'def'; length: 6144; max_length: 0; type: 253; decimals: 39 - 8: name: 'rows'/''; table: ''/''; db: ''; catalog: 'def'; length: 10; max_length: 0; type: 8; decimals: 0 - - 9: name: 'r_rows'/''; table: ''/''; db: ''; catalog: 'def'; length: 4; max_length: 0; type: 5; decimals: 10 + - 9: name: 'r_rows'/''; table: ''/''; db: ''; catalog: 'def'; length: 4; max_length: 0; type: 5; decimals: 2 - 10: name: 'filtered'/''; table: ''/''; db: ''; catalog: 'def'; length: 4; max_length: 0; type: 5; decimals: 2 - 11: name: 'r_filtered'/''; table: ''/''; db: ''; catalog: 'def'; length: 4; max_length: 0; type: 5; decimals: 2 - 12: name: 'Extra'/''; table: ''/''; db: ''; catalog: 'def'; length: 765; max_length: 0; type: 253; decimals: 39 diff --git a/mysql-test/main/old-mode.test b/mysql-test/main/old-mode.test index d7e8ce8ee55..e092ee78a2e 100644 --- a/mysql-test/main/old-mode.test +++ b/mysql-test/main/old-mode.test @@ -22,7 +22,8 @@ drop table t1,t2; --replace_column 1 <Id> 3 <Host> 6 <Time> 7 <State> # Embedded server is hardcoded to show "Writing to net" as STATE. ---replace_result "Writing to net" "NULL" +# ps-protocol will have Execute not Query +--replace_result "Writing to net" "NULL" "Execute" "Query" --replace_regex /localhost[:0-9]*/localhost/ SHOW PROCESSLIST; diff --git a/mysql-test/main/partition.result b/mysql-test/main/partition.result index bf5d45846a5..064817446b0 100644 --- a/mysql-test/main/partition.result +++ b/mysql-test/main/partition.result @@ -1321,7 +1321,7 @@ partition p2 values in (1)); end// call p()// drop procedure p// -drop table t1; +drop table t1// create procedure p () begin create table t1 (a int not null,b int not null,c int not null,primary key (a,b)) diff --git a/mysql-test/main/partition.test b/mysql-test/main/partition.test index 42929796f6b..89db3e92162 100644 --- a/mysql-test/main/partition.test +++ b/mysql-test/main/partition.test @@ -1198,7 +1198,7 @@ end// call p()// drop procedure p// -drop table t1; +drop table t1// create procedure p () begin diff --git a/mysql-test/main/show_check.test b/mysql-test/main/show_check.test index a24fa632ea5..6e622ffec27 100644 --- a/mysql-test/main/show_check.test +++ b/mysql-test/main/show_check.test @@ -47,7 +47,9 @@ insert into t1 values (5,5,5); check table t1 changed; check table t1 medium; check table t1 extended; +--disable_ps_protocol show index from t1; +--enable_ps_protocol --disable_metadata --error ER_DUP_ENTRY insert into t1 values (5,5,5); @@ -72,7 +74,9 @@ drop table t1; show variables like "wait_timeout%"; show variables like "WAIT_timeout%"; show variables like "this_doesn't_exists%"; +--disable_ps_protocol show table status from test like "this_doesn't_exists%"; +--enable_ps_protocol show databases; show databases like "test%"; --disable_metadata @@ -409,7 +413,9 @@ CREATE TABLE t1( PRIMARY KEY(field1(1000)) ); --enable_metadata +--disable_ps_protocol show index from t1; +--enable_ps_protocol --disable_metadata drop table t1; @@ -707,11 +713,15 @@ set names utf8; --echo ---------------------------------------------------------------- +--disable_ps_protocol SHOW CHARACTER SET LIKE 'utf8'; +--enable_ps_protocol --echo ---------------------------------------------------------------- +--disable_ps_protocol SHOW COLLATION LIKE 'latin1_bin'; +--enable_ps_protocol --echo ---------------------------------------------------------------- @@ -727,7 +737,9 @@ SHOW CREATE TABLE t1; --echo ---------------------------------------------------------------- +--disable_ps_protocol SHOW INDEX FROM t1; +--enable_ps_protocol --echo ---------------------------------------------------------------- @@ -774,8 +786,10 @@ SHOW COLUMNS FROM t1; --echo ---------------------------------------------------------------- +--disable_ps_protocol --replace_column 6 # SHOW TRIGGERS LIKE 't1'; +--enable_ps_protocol --echo ---------------------------------------------------------------- @@ -1364,9 +1378,11 @@ let $wait_timeout= 10; let $wait_condition= SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE '%GET_LOCK%' AND ID != CONNECTION_ID(); --source include/wait_condition.inc --replace_column 1 ### 3 ### 6 ### 7 ### +--replace_result "Execute" "Query" SHOW PROCESSLIST; SET NAMES utf8; --replace_column 1 ### 3 ### 6 ### 7 ### +--replace_result "Execute" "Query" SHOW PROCESSLIST; SELECT RELEASE_LOCK('t'); --connection con1 diff --git a/mysql-test/main/show_explain_ps.result b/mysql-test/main/show_explain_ps.result index fae432e830e..69ee2cab31d 100644 --- a/mysql-test/main/show_explain_ps.result +++ b/mysql-test/main/show_explain_ps.result @@ -31,12 +31,11 @@ count(*) set debug_dbug=''; select event_name from -performance_schema.events_stages_history_long +performance_schema.events_stages_history_long join +performance_schema.threads using (thread_id) where event_name like '%show explain' and -thread_id in(select thread_id -from performance_schema.events_statements_history_long -where EVENT_NAME='statement/sql/show_explain'); +processlist_id=$thr1; event_name stage/sql/Show explain drop table t0; diff --git a/mysql-test/main/show_explain_ps.test b/mysql-test/main/show_explain_ps.test index b43cd559e09..13cd1538143 100644 --- a/mysql-test/main/show_explain_ps.test +++ b/mysql-test/main/show_explain_ps.test @@ -49,12 +49,12 @@ reap; set debug_dbug=''; -select event_name -from -performance_schema.events_stages_history_long -where - event_name like '%show explain' and - thread_id in(select thread_id - from performance_schema.events_statements_history_long - where EVENT_NAME='statement/sql/show_explain'); +evalp select event_name + from + performance_schema.events_stages_history_long join + performance_schema.threads using (thread_id) + where + event_name like '%show explain' and + processlist_id=$thr1; + drop table t0; diff --git a/mysql-test/main/sp-ucs2.result b/mysql-test/main/sp-ucs2.result index b8cc5dfd73d..ca448efa535 100644 --- a/mysql-test/main/sp-ucs2.result +++ b/mysql-test/main/sp-ucs2.result @@ -32,61 +32,55 @@ RETURNS VARCHAR(64) UNICODE BINARY BEGIN RETURN ''; END| -SHOW CREATE FUNCTION f; -DROP FUNCTION f; +SHOW CREATE FUNCTION f| +Function sql_mode Create Function character_set_client collation_connection Database Collation +f STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `f`() RETURNS varchar(64) CHARSET ucs2 COLLATE ucs2_bin +BEGIN +RETURN ''; +END latin1 latin1_swedish_ci latin1_swedish_ci +DROP FUNCTION f| CREATE FUNCTION f() RETURNS VARCHAR(64) BINARY UNICODE BEGIN RETURN ''; END| +SHOW CREATE FUNCTION f| Function sql_mode Create Function character_set_client collation_connection Database Collation f STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `f`() RETURNS varchar(64) CHARSET ucs2 COLLATE ucs2_bin BEGIN RETURN ''; END latin1 latin1_swedish_ci latin1_swedish_ci -SHOW CREATE FUNCTION f; -DROP FUNCTION f; -# -# Testing keywords ASCII + BINARY -# +DROP FUNCTION f| CREATE FUNCTION f() RETURNS VARCHAR(64) ASCII BINARY BEGIN RETURN ''; END| +SHOW CREATE FUNCTION f| Function sql_mode Create Function character_set_client collation_connection Database Collation -f STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `f`() RETURNS varchar(64) CHARSET ucs2 COLLATE ucs2_bin +f STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `f`() RETURNS varchar(64) CHARSET latin1 COLLATE latin1_bin BEGIN RETURN ''; END latin1 latin1_swedish_ci latin1_swedish_ci -SHOW CREATE FUNCTION f; -DROP FUNCTION f; +DROP FUNCTION f| CREATE FUNCTION f() RETURNS VARCHAR(64) BINARY ASCII BEGIN RETURN ''; END| +SHOW CREATE FUNCTION f| Function sql_mode Create Function character_set_client collation_connection Database Collation f STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `f`() RETURNS varchar(64) CHARSET latin1 COLLATE latin1_bin BEGIN RETURN ''; END latin1 latin1_swedish_ci latin1_swedish_ci -SHOW CREATE FUNCTION f; -DROP FUNCTION f; -# -# Testing COLLATE in OUT parameter -# +DROP FUNCTION f| CREATE PROCEDURE p1(IN f1 VARCHAR(64) CHARACTER SET ucs2 COLLATE ucs2_czech_ci, OUT f2 VARCHAR(64) CHARACTER SET ucs2 COLLATE ucs2_polish_ci) BEGIN SET f2= f1; SET f2= concat(collation(f1), ' ', collation(f2)); END| -Function sql_mode Create Function character_set_client collation_connection Database Collation -f STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `f`() RETURNS varchar(64) CHARSET latin1 COLLATE latin1_bin -BEGIN -RETURN ''; -END latin1 latin1_swedish_ci latin1_swedish_ci CREATE FUNCTION f1() RETURNS VARCHAR(64) CHARACTER SET ucs2 BEGIN diff --git a/mysql-test/main/sp-ucs2.test b/mysql-test/main/sp-ucs2.test index 3532169e5a1..a1aec8071b4 100644 --- a/mysql-test/main/sp-ucs2.test +++ b/mysql-test/main/sp-ucs2.test @@ -52,16 +52,16 @@ CREATE FUNCTION f() BEGIN RETURN ''; END| -SHOW CREATE FUNCTION f; -DROP FUNCTION f; +SHOW CREATE FUNCTION f| +DROP FUNCTION f| CREATE FUNCTION f() RETURNS VARCHAR(64) BINARY UNICODE BEGIN RETURN ''; END| -SHOW CREATE FUNCTION f; -DROP FUNCTION f; +SHOW CREATE FUNCTION f| +DROP FUNCTION f| # @@ -72,16 +72,16 @@ CREATE FUNCTION f() BEGIN RETURN ''; END| -SHOW CREATE FUNCTION f; -DROP FUNCTION f; +SHOW CREATE FUNCTION f| +DROP FUNCTION f| CREATE FUNCTION f() RETURNS VARCHAR(64) BINARY ASCII BEGIN RETURN ''; END| -SHOW CREATE FUNCTION f; -DROP FUNCTION f; +SHOW CREATE FUNCTION f| +DROP FUNCTION f| # # Testing COLLATE in OUT parameter diff --git a/mysql-test/main/sp.result b/mysql-test/main/sp.result index 191b889b078..61ba2116969 100644 --- a/mysql-test/main/sp.result +++ b/mysql-test/main/sp.result @@ -6798,7 +6798,7 @@ ERROR 42S02: Table 'test.t1' doesn't exist create table t1 (a integer)$ call p1$ a -alter table t1 add b integer; +alter table t1 add b integer$ call p1$ a drop table t1; diff --git a/mysql-test/main/sp.test b/mysql-test/main/sp.test index b0c9120007f..658d41a4736 100644 --- a/mysql-test/main/sp.test +++ b/mysql-test/main/sp.test @@ -8053,7 +8053,7 @@ create procedure p1() begin select * from t1; end$ call p1$ create table t1 (a integer)$ call p1$ -alter table t1 add b integer; +alter table t1 add b integer$ call p1$ delimiter ;$ diff --git a/mysql-test/main/sp_notembedded.result b/mysql-test/main/sp_notembedded.result index 8edb9e79b70..d337d50e18a 100644 --- a/mysql-test/main/sp_notembedded.result +++ b/mysql-test/main/sp_notembedded.result @@ -74,7 +74,7 @@ select res; end| create table t3 (a int)| insert into t3 values (0)| -create view v1 as select a from t3; +create view v1 as select a from t3| create procedure bug10100pt(level int, lim int) begin if level < lim then diff --git a/mysql-test/main/sp_notembedded.test b/mysql-test/main/sp_notembedded.test index 41bfd871c39..1b481767fbe 100644 --- a/mysql-test/main/sp_notembedded.test +++ b/mysql-test/main/sp_notembedded.test @@ -118,7 +118,7 @@ end| # a procedure which use tables and recursion create table t3 (a int)| insert into t3 values (0)| -create view v1 as select a from t3; +create view v1 as select a from t3| create procedure bug10100pt(level int, lim int) begin if level < lim then diff --git a/mysql-test/main/sp_trans.result b/mysql-test/main/sp_trans.result index ef802279c9c..deb0d6797fe 100644 --- a/mysql-test/main/sp_trans.result +++ b/mysql-test/main/sp_trans.result @@ -640,7 +640,7 @@ TRUNCATE TABLE t1; END| LOCK TABLES t1 WRITE| CALL p1()| -FLUSH TABLES; +FLUSH TABLES| UNLOCK TABLES| CALL p1()| DROP PROCEDURE p1| diff --git a/mysql-test/main/sp_trans.test b/mysql-test/main/sp_trans.test index a9759b99269..7d6faba9789 100644 --- a/mysql-test/main/sp_trans.test +++ b/mysql-test/main/sp_trans.test @@ -689,7 +689,7 @@ END| LOCK TABLES t1 WRITE| CALL p1()| -FLUSH TABLES; +FLUSH TABLES| UNLOCK TABLES| CALL p1()| diff --git a/mysql-test/main/subselect_sj_mat.test b/mysql-test/main/subselect_sj_mat.test index 7853b528e8f..4bd8dfdf058 100644 --- a/mysql-test/main/subselect_sj_mat.test +++ b/mysql-test/main/subselect_sj_mat.test @@ -1570,7 +1570,9 @@ INSERT INTO t2 values(1),(2); EXPLAIN SELECT * FROM t1 WHERE a IN (SELECT * FROM t2 GROUP BY a HAVING a > 1); flush status; CREATE TABLE t3 SELECT * FROM t1 WHERE a IN (SELECT * FROM t2 GROUP BY a HAVING a > 1); +--disable_ps_protocol SHOW STATUS LIKE 'Created_tmp_tables'; +--enable_ps_protocol DROP TABLE t1,t2,t3; --echo # diff --git a/mysql-test/main/temp_table.test b/mysql-test/main/temp_table.test index a528e27b890..a1e61b31a82 100644 --- a/mysql-test/main/temp_table.test +++ b/mysql-test/main/temp_table.test @@ -115,8 +115,10 @@ CREATE TABLE t1 ( INSERT INTO t1 VALUES ('2002-10-24 14:50:32'),('2002-10-24 14:50:33'),('2002-10-24 14:50:34'),('2002-10-24 14:50:34'),('2002-10-24 14:50:34'),('2002-10-24 14:50:35'),('2002-10-24 14:50:35'),('2002-10-24 14:50:35'),('2002-10-24 14:50:35'),('2002-10-24 14:50:36'),('2002-10-24 14:50:36'),('2002-10-24 14:50:36'),('2002-10-24 14:50:36'),('2002-10-24 14:50:37'),('2002-10-24 14:50:37'),('2002-10-24 14:50:37'),('2002-10-24 14:50:37'),('2002-10-24 14:50:38'),('2002-10-24 14:50:38'),('2002-10-24 14:50:38'),('2002-10-24 14:50:39'),('2002-10-24 14:50:39'),('2002-10-24 14:50:39'),('2002-10-24 14:50:39'),('2002-10-24 14:50:40'),('2002-10-24 14:50:40'),('2002-10-24 14:50:40'); flush status; +--disable_ps_protocol select * from t1 group by d; show status like "created_tmp%tables"; +--enable_ps_protocol drop table t1; # Fix for BUG#8921: Check that temporary table is ingored by view commands. diff --git a/mysql-test/main/tmp_table_count-7586.test b/mysql-test/main/tmp_table_count-7586.test index e7bac127815..8bfb0e7c5cf 100644 --- a/mysql-test/main/tmp_table_count-7586.test +++ b/mysql-test/main/tmp_table_count-7586.test @@ -9,12 +9,16 @@ create view v2 as select a from t2; flush status; select * from v2; +--disable_ps_protocol show status like '%Created_tmp%'; +--enable_ps_protocol explain select * from v2; select * from (select * from t2) T1; +--disable_ps_protocol show status like '%Created_tmp%'; +--enable_ps_protocol explain select * from (select * from t2) T1; diff --git a/mysql-test/main/type_year.result b/mysql-test/main/type_year.result index c4b72483c99..99c3c50ea8c 100644 --- a/mysql-test/main/type_year.result +++ b/mysql-test/main/type_year.result @@ -444,6 +444,15 @@ Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2010 DROP TABLE t1; # +# MDEV-16958 Assertion `field_length < 5' failed in Field_year::val_str or data corruption upon SELECT with UNION and aggregate functions +# +CREATE TABLE t1 (f YEAR); +INSERT IGNORE INTO t1 VALUES (1971),(1972); +SELECT MAX( NULLIF( f, '1900' ) ) AS f FROM t1 UNION SELECT MAX( NULLIF( f, '1900' ) ) AS f FROM t1; +f +1972 +DROP TABLE t1; +# # End of 10.1 tests # # diff --git a/mysql-test/main/type_year.test b/mysql-test/main/type_year.test index 5a02c038caa..af26a69c581 100644 --- a/mysql-test/main/type_year.test +++ b/mysql-test/main/type_year.test @@ -214,6 +214,17 @@ SELECT * FROM t1 WHERE a=10 AND a>=10; EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=10 AND a>=10; DROP TABLE t1; + +--echo # +--echo # MDEV-16958 Assertion `field_length < 5' failed in Field_year::val_str or data corruption upon SELECT with UNION and aggregate functions +--echo # + +CREATE TABLE t1 (f YEAR); +INSERT IGNORE INTO t1 VALUES (1971),(1972); +SELECT MAX( NULLIF( f, '1900' ) ) AS f FROM t1 UNION SELECT MAX( NULLIF( f, '1900' ) ) AS f FROM t1; +DROP TABLE t1; + + --echo # --echo # End of 10.1 tests --echo # diff --git a/mysql-test/main/userstat.result b/mysql-test/main/userstat.result index 1db891e0184..c838036f118 100644 --- a/mysql-test/main/userstat.result +++ b/mysql-test/main/userstat.result @@ -146,7 +146,7 @@ show table_statistics; Table_schema Table_name Rows_read Rows_changed Rows_changed_x_#indexes show index_statistics; Table_schema Table_name Index_name Rows_read -select TOTAL_CONNECTIONS, TOTAL_SSL_CONNECTIONS, CONCURRENT_CONNECTIONS, ROWS_READ, ROWS_SENT, ROWS_DELETED, ROWS_INSERTED, ROWS_UPDATED, SELECT_COMMANDS, UPDATE_COMMANDS, OTHER_COMMANDS, COMMIT_TRANSACTIONS, ROLLBACK_TRANSACTIONS, DENIED_CONNECTIONS, LOST_CONNECTIONS, ACCESS_DENIED, EMPTY_QUERIES from information_schema.client_statistics;; +select TOTAL_CONNECTIONS, TOTAL_SSL_CONNECTIONS, CONCURRENT_CONNECTIONS, ROWS_READ, ROWS_SENT, ROWS_DELETED, ROWS_INSERTED, ROWS_UPDATED, SELECT_COMMANDS, UPDATE_COMMANDS, COMMIT_TRANSACTIONS, ROLLBACK_TRANSACTIONS, DENIED_CONNECTIONS, LOST_CONNECTIONS, ACCESS_DENIED, EMPTY_QUERIES from information_schema.client_statistics;; TOTAL_CONNECTIONS 2 TOTAL_SSL_CONNECTIONS 1 CONCURRENT_CONNECTIONS 0 @@ -157,14 +157,13 @@ ROWS_INSERTED 7 ROWS_UPDATED 5 SELECT_COMMANDS 4 UPDATE_COMMANDS 11 -OTHER_COMMANDS 7 COMMIT_TRANSACTIONS 19 ROLLBACK_TRANSACTIONS 2 DENIED_CONNECTIONS 0 LOST_CONNECTIONS 0 ACCESS_DENIED 0 EMPTY_QUERIES 1 -select TOTAL_CONNECTIONS, TOTAL_SSL_CONNECTIONS, CONCURRENT_CONNECTIONS, ROWS_READ, ROWS_SENT, ROWS_DELETED, ROWS_INSERTED, ROWS_UPDATED, SELECT_COMMANDS, UPDATE_COMMANDS, OTHER_COMMANDS, COMMIT_TRANSACTIONS, ROLLBACK_TRANSACTIONS, DENIED_CONNECTIONS, LOST_CONNECTIONS, ACCESS_DENIED, EMPTY_QUERIES from information_schema.user_statistics;; +select TOTAL_CONNECTIONS, TOTAL_SSL_CONNECTIONS, CONCURRENT_CONNECTIONS, ROWS_READ, ROWS_SENT, ROWS_DELETED, ROWS_INSERTED, ROWS_UPDATED, SELECT_COMMANDS, UPDATE_COMMANDS, COMMIT_TRANSACTIONS, ROLLBACK_TRANSACTIONS, DENIED_CONNECTIONS, LOST_CONNECTIONS, ACCESS_DENIED, EMPTY_QUERIES from information_schema.user_statistics;; TOTAL_CONNECTIONS 2 TOTAL_SSL_CONNECTIONS 1 CONCURRENT_CONNECTIONS 0 @@ -175,13 +174,18 @@ ROWS_INSERTED 7 ROWS_UPDATED 5 SELECT_COMMANDS 4 UPDATE_COMMANDS 11 -OTHER_COMMANDS 7 COMMIT_TRANSACTIONS 19 ROLLBACK_TRANSACTIONS 2 DENIED_CONNECTIONS 0 LOST_CONNECTIONS 0 ACCESS_DENIED 0 EMPTY_QUERIES 1 +select OTHER_COMMANDS IN (7,8) from information_schema.client_statistics; +OTHER_COMMANDS IN (7,8) +1 +select OTHER_COMMANDS IN (7,8) from information_schema.user_statistics; +OTHER_COMMANDS IN (7,8) +1 flush table_statistics; flush index_statistics; select * from information_schema.index_statistics; diff --git a/mysql-test/main/userstat.test b/mysql-test/main/userstat.test index 9ce3a32c442..547138cfeaa 100644 --- a/mysql-test/main/userstat.test +++ b/mysql-test/main/userstat.test @@ -73,8 +73,11 @@ select * from information_schema.index_statistics; select * from information_schema.table_statistics; show table_statistics; show index_statistics; ---query_vertical select TOTAL_CONNECTIONS, TOTAL_SSL_CONNECTIONS, CONCURRENT_CONNECTIONS, ROWS_READ, ROWS_SENT, ROWS_DELETED, ROWS_INSERTED, ROWS_UPDATED, SELECT_COMMANDS, UPDATE_COMMANDS, OTHER_COMMANDS, COMMIT_TRANSACTIONS, ROLLBACK_TRANSACTIONS, DENIED_CONNECTIONS, LOST_CONNECTIONS, ACCESS_DENIED, EMPTY_QUERIES from information_schema.client_statistics; ---query_vertical select TOTAL_CONNECTIONS, TOTAL_SSL_CONNECTIONS, CONCURRENT_CONNECTIONS, ROWS_READ, ROWS_SENT, ROWS_DELETED, ROWS_INSERTED, ROWS_UPDATED, SELECT_COMMANDS, UPDATE_COMMANDS, OTHER_COMMANDS, COMMIT_TRANSACTIONS, ROLLBACK_TRANSACTIONS, DENIED_CONNECTIONS, LOST_CONNECTIONS, ACCESS_DENIED, EMPTY_QUERIES from information_schema.user_statistics; +--query_vertical select TOTAL_CONNECTIONS, TOTAL_SSL_CONNECTIONS, CONCURRENT_CONNECTIONS, ROWS_READ, ROWS_SENT, ROWS_DELETED, ROWS_INSERTED, ROWS_UPDATED, SELECT_COMMANDS, UPDATE_COMMANDS, COMMIT_TRANSACTIONS, ROLLBACK_TRANSACTIONS, DENIED_CONNECTIONS, LOST_CONNECTIONS, ACCESS_DENIED, EMPTY_QUERIES from information_schema.client_statistics; +--query_vertical select TOTAL_CONNECTIONS, TOTAL_SSL_CONNECTIONS, CONCURRENT_CONNECTIONS, ROWS_READ, ROWS_SENT, ROWS_DELETED, ROWS_INSERTED, ROWS_UPDATED, SELECT_COMMANDS, UPDATE_COMMANDS, COMMIT_TRANSACTIONS, ROLLBACK_TRANSACTIONS, DENIED_CONNECTIONS, LOST_CONNECTIONS, ACCESS_DENIED, EMPTY_QUERIES from information_schema.user_statistics; +# different values in --ps-protocol +select OTHER_COMMANDS IN (7,8) from information_schema.client_statistics; +select OTHER_COMMANDS IN (7,8) from information_schema.user_statistics; flush table_statistics; flush index_statistics; select * from information_schema.index_statistics; diff --git a/mysql-test/main/view.result b/mysql-test/main/view.result index 2629eb46200..08d570b86b1 100644 --- a/mysql-test/main/view.result +++ b/mysql-test/main/view.result @@ -6694,6 +6694,20 @@ testcase drop view v1; drop table t1; # +# MDEV-18502: Server crash in find_field_in_tables upon 2nd execution of SP which causes ER_WRONG_GROUP_FIELD +# +CREATE TABLE t1 (id INT, f VARCHAR(1)); +CREATE VIEW v1 AS SELECT * FROM t1; +INSERT INTO t1 VALUES (1,'a'),(2,'b'); +CREATE PROCEDURE sp() SELECT f AS f1, MAX(id) AS f2 FROM v1 GROUP BY f1, f2 ORDER BY f1; +CALL sp; +ERROR 42000: Can't group on 'f2' +CALL sp; +ERROR 42000: Can't group on 'f2' +DROP PROCEDURE sp; +DROP VIEW v1; +DROP TABLE t1; +# # End of 10.2 tests # # diff --git a/mysql-test/main/view.test b/mysql-test/main/view.test index 643f050cee5..ef4a7acd3ef 100644 --- a/mysql-test/main/view.test +++ b/mysql-test/main/view.test @@ -2369,6 +2369,7 @@ DROP TABLE t1; # Bug#15943 mysql_next_result hangs on invalid SHOW CREATE VIEW # +--disable_ps_protocol delimiter //; drop table if exists t1; drop view if exists v1; @@ -2379,6 +2380,7 @@ show create view v1; drop view v1; // delimiter ;// +--enable_ps_protocol # @@ -3889,7 +3891,9 @@ CREATE VIEW v1 AS SELECT f1() FROM t1; let $MYSQLD_DATADIR= `SELECT @@datadir`; copy_file std_data/bug48449.frm $MYSQLD_DATADIR/test/v2.frm; +enable_prepare_warnings; SHOW CREATE VIEW v1; +disable_prepare_warnings; DROP VIEW v1,v2; DROP TABLE t1,t2; @@ -6399,6 +6403,22 @@ drop view v1; drop table t1; --echo # +--echo # MDEV-18502: Server crash in find_field_in_tables upon 2nd execution of SP which causes ER_WRONG_GROUP_FIELD +--echo # + +CREATE TABLE t1 (id INT, f VARCHAR(1)); +CREATE VIEW v1 AS SELECT * FROM t1; +INSERT INTO t1 VALUES (1,'a'),(2,'b'); +CREATE PROCEDURE sp() SELECT f AS f1, MAX(id) AS f2 FROM v1 GROUP BY f1, f2 ORDER BY f1; +--error ER_WRONG_GROUP_FIELD +CALL sp; +--error ER_WRONG_GROUP_FIELD +CALL sp; +DROP PROCEDURE sp; +DROP VIEW v1; +DROP TABLE t1; + +--echo # --echo # End of 10.2 tests --echo # diff --git a/mysql-test/main/win.result b/mysql-test/main/win.result index 73f9c65b41f..d9fab5f60f0 100644 --- a/mysql-test/main/win.result +++ b/mysql-test/main/win.result @@ -3489,6 +3489,23 @@ ifnull(max(n1) over (partition by n1),'aaa') drop table t1; drop view v1; # +# MDEV-18431: Select max + row_number giving incorrect result +# +create table t1 (id int, v int); +insert into t1 values (1, 1), (1,2), (1,3), (2, 1), (2, 2); +select e.id, +(select max(t1.v) from t1 where t1.id=e.id) as a, +row_number() over (partition by e.id order by e.v) as b, +(select max(t1.v) from t1 where t1.id=e.id) + (row_number() over (partition by e.id order by e.v)) as sum_a_b +from t1 e; +id a b sum_a_b +1 3 1 4 +1 3 2 5 +1 3 3 6 +2 2 1 3 +2 2 2 4 +drop table t1; +# # End of 10.2 tests # # diff --git a/mysql-test/main/win.test b/mysql-test/main/win.test index 15e96ec7e8e..6ebe1d653cf 100644 --- a/mysql-test/main/win.test +++ b/mysql-test/main/win.test @@ -2242,6 +2242,20 @@ drop table t1; drop view v1; --echo # +--echo # MDEV-18431: Select max + row_number giving incorrect result +--echo # + +create table t1 (id int, v int); +insert into t1 values (1, 1), (1,2), (1,3), (2, 1), (2, 2); + +select e.id, + (select max(t1.v) from t1 where t1.id=e.id) as a, + row_number() over (partition by e.id order by e.v) as b, + (select max(t1.v) from t1 where t1.id=e.id) + (row_number() over (partition by e.id order by e.v)) as sum_a_b +from t1 e; +drop table t1; + +--echo # --echo # End of 10.2 tests --echo # |