diff options
Diffstat (limited to 'mysql-test/main')
102 files changed, 2549 insertions, 136 deletions
diff --git a/mysql-test/main/bootstrap.test b/mysql-test/main/bootstrap.test index d75be403f13..5484cd1a798 100644 --- a/mysql-test/main/bootstrap.test +++ b/mysql-test/main/bootstrap.test @@ -62,14 +62,23 @@ drop table t1; SELECT 'bug' as '' FROM INFORMATION_SCHEMA.ENGINES WHERE engine='innodb' and SUPPORT='YES'; +--source include/kill_mysqld.inc # # MDEV-13063 Server crashes in intern_plugin_lock or assertion `plugin_ptr->ref_count == 1' fails in plugin_init # ---source include/kill_mysqld.inc --error 1 --exec $MYSQLD_BOOTSTRAP_CMD --myisam_recover_options=NONE ---source include/start_mysqld.inc +# +# MDEV-19349 mysql_install_db: segfault at tmp_file_prefix check +# +--write_file $MYSQLTEST_VARDIR/tmp/1 +use test; +EOF +--exec $MYSQLD_BOOTSTRAP_CMD < $MYSQLTEST_VARDIR/tmp/1 >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1 +--remove_file $MYSQLTEST_VARDIR/tmp/1 + +--source include/start_mysqld.inc --echo End of 5.5 tests --source include/not_windows_embedded.inc diff --git a/mysql-test/main/cast.result b/mysql-test/main/cast.result index 268999c9ca0..496dea7c96f 100644 --- a/mysql-test/main/cast.result +++ b/mysql-test/main/cast.result @@ -262,12 +262,12 @@ select cast(1000 as double(5,2)); cast(1000 as double(5,2)) 999.99 Warnings: -Warning 1264 Out of range value for column 'cast(1000 as double(5,2))' at row 1 +Note 1264 Out of range value for column 'cast(1000 as double(5,2))' at row 1 select cast(-1000 as double(5,2)); cast(-1000 as double(5,2)) -999.99 Warnings: -Warning 1264 Out of range value for column 'cast(-1000 as double(5,2))' at row 1 +Note 1264 Out of range value for column 'cast(-1000 as double(5,2))' at row 1 select cast(010203101112.121314 as datetime); cast(010203101112.121314 as datetime) 2001-02-03 10:11:12 diff --git a/mysql-test/main/create_drop_binlog.result b/mysql-test/main/create_drop_binlog.result index b8f8b61c359..4a8c75a3dae 100644 --- a/mysql-test/main/create_drop_binlog.result +++ b/mysql-test/main/create_drop_binlog.result @@ -246,7 +246,11 @@ Log_name Pos Event_type Server_id End_log_pos Info RESET MASTER; SET timestamp=UNIX_TIMESTAMP('2014-11-01 10:20:30'); CREATE OR REPLACE EVENT ev1 ON SCHEDULE EVERY 1 SECOND DO DROP TABLE IF EXISTS t1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. CREATE OR REPLACE EVENT ev1 ON SCHEDULE EVERY 1 SECOND DO DROP TABLE IF EXISTS t2; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SELECT EVENT_NAME, EVENT_DEFINITION FROM INFORMATION_SCHEMA.EVENTS; EVENT_NAME EVENT_DEFINITION ev1 DROP TABLE IF EXISTS t2 diff --git a/mysql-test/main/create_drop_event.result b/mysql-test/main/create_drop_event.result index 0d69e85dfd6..fadfbb6a3b3 100644 --- a/mysql-test/main/create_drop_event.result +++ b/mysql-test/main/create_drop_event.result @@ -4,6 +4,8 @@ CREATE TABLE t1 (a INT); CREATE OR REPLACE EVENT IF NOT EXISTS ev1 ON SCHEDULE EVERY 1 SECOND DO DROP DATABASE db1; ERROR HY000: Incorrect usage of OR REPLACE and IF NOT EXISTS CREATE EVENT ev1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO t1 VALUES (10); +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SELECT EVENT_NAME, EVENT_DEFINITION FROM INFORMATION_SCHEMA.EVENTS; EVENT_NAME EVENT_DEFINITION ev1 INSERT INTO t1 VALUES (10) @@ -21,10 +23,13 @@ ev1 INSERT INTO t1 VALUES (10) CREATE EVENT IF NOT EXISTS ev1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO t1 VALUES (12); Warnings: Note 1537 Event 'ev1' already exists +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SELECT EVENT_NAME, EVENT_DEFINITION FROM INFORMATION_SCHEMA.EVENTS; EVENT_NAME EVENT_DEFINITION ev1 INSERT INTO t1 VALUES (10) CREATE OR REPLACE EVENT ev1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO t1 VALUES (13); +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SELECT EVENT_NAME, EVENT_DEFINITION FROM INFORMATION_SCHEMA.EVENTS; EVENT_NAME EVENT_DEFINITION ev1 INSERT INTO t1 VALUES (13) diff --git a/mysql-test/main/ctype_big5.result b/mysql-test/main/ctype_big5.result index f61fc4c8400..8895e2d89df 100644 --- a/mysql-test/main/ctype_big5.result +++ b/mysql-test/main/ctype_big5.result @@ -220,6 +220,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +big5_chinese_ci +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 CREATE TABLE t1 AS SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); @@ -450,6 +456,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +big5_bin +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 CREATE TABLE t1 AS SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); diff --git a/mysql-test/main/ctype_euckr.result b/mysql-test/main/ctype_euckr.result index 3006e77412a..f8dab97ce1d 100644 --- a/mysql-test/main/ctype_euckr.result +++ b/mysql-test/main/ctype_euckr.result @@ -220,6 +220,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +euckr_korean_ci +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 CREATE TABLE t1 AS SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); @@ -355,6 +361,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +euckr_bin +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 CREATE TABLE t1 AS SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); diff --git a/mysql-test/main/ctype_gb2312.result b/mysql-test/main/ctype_gb2312.result index 8a0950caea8..2998615b1cb 100644 --- a/mysql-test/main/ctype_gb2312.result +++ b/mysql-test/main/ctype_gb2312.result @@ -220,6 +220,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +gb2312_chinese_ci +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 CREATE TABLE t1 AS SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); @@ -436,6 +442,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +gb2312_bin +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 CREATE TABLE t1 AS SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); diff --git a/mysql-test/main/ctype_gbk.result b/mysql-test/main/ctype_gbk.result index 9bf69584725..c2a84a7ea70 100644 --- a/mysql-test/main/ctype_gbk.result +++ b/mysql-test/main/ctype_gbk.result @@ -220,6 +220,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +gbk_chinese_ci +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 CREATE TABLE t1 AS SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); @@ -436,6 +442,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +gbk_bin +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 CREATE TABLE t1 AS SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); diff --git a/mysql-test/main/ctype_latin1.result b/mysql-test/main/ctype_latin1.result index 59a706a7fd8..62ab83a70a2 100644 --- a/mysql-test/main/ctype_latin1.result +++ b/mysql-test/main/ctype_latin1.result @@ -506,6 +506,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +latin1_swedish_ci +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 # # MDEV-4842 STR_TO_DATE does not work with UCS2/UTF16/UTF32 # @@ -636,6 +642,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +latin1_bin +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 SELECT strcmp('a','a '), strcmp('a ','a'); strcmp('a','a ') strcmp('a ','a') 0 0 diff --git a/mysql-test/main/ctype_sjis.result b/mysql-test/main/ctype_sjis.result index 090bb12fc42..c897268b204 100644 --- a/mysql-test/main/ctype_sjis.result +++ b/mysql-test/main/ctype_sjis.result @@ -189,6 +189,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +sjis_japanese_ci +SELECT '\%b' LIKE '%\%'; +'_%b' LIKE '%_%' +0 CREATE TABLE t1 AS SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); @@ -343,6 +349,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +sjis_bin +SELECT '\%b' LIKE '%\%'; +'_%b' LIKE '%_%' +0 CREATE TABLE t1 AS SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); diff --git a/mysql-test/main/ctype_tis620.result b/mysql-test/main/ctype_tis620.result index cf66c81c647..9650c366d38 100644 --- a/mysql-test/main/ctype_tis620.result +++ b/mysql-test/main/ctype_tis620.result @@ -3033,6 +3033,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +tis620_thai_ci +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 drop table if exists t1; create table t1 select repeat('a',10) as c1; delete from t1; @@ -3331,6 +3337,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +tis620_bin +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 # # MDEV-7149 Constant condition propagation erroneously applied for LIKE # diff --git a/mysql-test/main/ctype_uca.result b/mysql-test/main/ctype_uca.result index 7394ec82924..41d2a1149ee 100644 --- a/mysql-test/main/ctype_uca.result +++ b/mysql-test/main/ctype_uca.result @@ -6233,6 +6233,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +utf8_unicode_ci +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 "BEGIN ctype_german.inc" drop table if exists t1; create table t1 as select repeat(' ', 64) as s1; diff --git a/mysql-test/main/ctype_ucs.result b/mysql-test/main/ctype_ucs.result index a59a25db4e6..5a4119bbe51 100644 --- a/mysql-test/main/ctype_ucs.result +++ b/mysql-test/main/ctype_ucs.result @@ -844,6 +844,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +ucs2_general_ci +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 "BEGIN ctype_german.inc" drop table if exists t1; create table t1 as select repeat(' ', 64) as s1; @@ -1093,6 +1099,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +ucs2_bin +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 CREATE TABLE t1 AS SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); diff --git a/mysql-test/main/ctype_ujis.result b/mysql-test/main/ctype_ujis.result index a1fcce33bbb..8d01212c9b1 100644 --- a/mysql-test/main/ctype_ujis.result +++ b/mysql-test/main/ctype_ujis.result @@ -2327,6 +2327,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +ujis_japanese_ci +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 CREATE TABLE t1 AS SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); @@ -2462,6 +2468,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +ujis_bin +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 CREATE TABLE t1 AS SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); diff --git a/mysql-test/main/ctype_utf16.result b/mysql-test/main/ctype_utf16.result index 1417e0ba752..5e1c92929d6 100644 --- a/mysql-test/main/ctype_utf16.result +++ b/mysql-test/main/ctype_utf16.result @@ -669,6 +669,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +utf16_general_ci +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 SET NAMES latin1; SET collation_connection='utf16_bin'; create table t1 select repeat('a',4000) a; @@ -806,6 +812,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +utf16_bin +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 select hex(substr(_utf16 0x00e400e50068,1)); hex(substr(_utf16 0x00e400e50068,1)) 00E400E50068 diff --git a/mysql-test/main/ctype_utf16_uca.result b/mysql-test/main/ctype_utf16_uca.result index 17f52a91c7b..72058ba37fe 100644 --- a/mysql-test/main/ctype_utf16_uca.result +++ b/mysql-test/main/ctype_utf16_uca.result @@ -2952,6 +2952,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +utf16_unicode_ci +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 "BEGIN ctype_german.inc" drop table if exists t1; create table t1 as select repeat(' ', 64) as s1; diff --git a/mysql-test/main/ctype_utf16le.result b/mysql-test/main/ctype_utf16le.result index 633809b51fa..ae389ed7390 100644 --- a/mysql-test/main/ctype_utf16le.result +++ b/mysql-test/main/ctype_utf16le.result @@ -713,6 +713,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +utf16le_general_ci +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 SET NAMES utf8, collation_connection='utf16le_bin'; create table t1 select repeat('a',4000) a; delete from t1; @@ -849,6 +855,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +utf16le_bin +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 # # Bug#10344 Some string functions fail for UCS2 # diff --git a/mysql-test/main/ctype_utf32.result b/mysql-test/main/ctype_utf32.result index 2da1f22f592..cae8ba4ebaa 100644 --- a/mysql-test/main/ctype_utf32.result +++ b/mysql-test/main/ctype_utf32.result @@ -668,6 +668,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +utf32_general_ci +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 SET NAMES latin1; SET collation_connection='utf32_bin'; create table t1 select repeat('a',4000) a; @@ -805,6 +811,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +utf32_bin +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 select hex(substr(_utf32 0x000000e4000000e500000068,1)); hex(substr(_utf32 0x000000e4000000e500000068,1)) 000000E4000000E500000068 diff --git a/mysql-test/main/ctype_utf32_uca.result b/mysql-test/main/ctype_utf32_uca.result index aa8d2002bee..cf816f35d4e 100644 --- a/mysql-test/main/ctype_utf32_uca.result +++ b/mysql-test/main/ctype_utf32_uca.result @@ -2952,6 +2952,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +utf32_unicode_ci +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 "BEGIN ctype_german.inc" drop table if exists t1; create table t1 as select repeat(' ', 64) as s1; diff --git a/mysql-test/main/ctype_utf8.result b/mysql-test/main/ctype_utf8.result index 5f66e60bc65..de2cd005c22 100644 --- a/mysql-test/main/ctype_utf8.result +++ b/mysql-test/main/ctype_utf8.result @@ -1032,6 +1032,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +utf8_general_ci +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 "BEGIN ctype_german.inc" drop table if exists t1; create table t1 as select repeat(' ', 64) as s1; @@ -1263,6 +1269,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +utf8_bin +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 CREATE TABLE t1 ( user varchar(255) NOT NULL default '' ) ENGINE=MyISAM DEFAULT CHARSET=latin1; diff --git a/mysql-test/main/ctype_utf8mb4.result b/mysql-test/main/ctype_utf8mb4.result index fac15a5a2cd..911108bf74a 100644 --- a/mysql-test/main/ctype_utf8mb4.result +++ b/mysql-test/main/ctype_utf8mb4.result @@ -1032,6 +1032,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +utf8mb4_general_ci +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 "BEGIN ctype_german.inc" drop table if exists t1; create table t1 as select repeat(' ', 64) as s1; @@ -1284,6 +1290,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +utf8mb4_bin +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 CREATE TABLE t1 ( user varchar(255) NOT NULL default '' ) ENGINE=MyISAM DEFAULT CHARSET=latin1; diff --git a/mysql-test/main/ctype_utf8mb4_heap.result b/mysql-test/main/ctype_utf8mb4_heap.result index 85668451181..18213e65166 100644 --- a/mysql-test/main/ctype_utf8mb4_heap.result +++ b/mysql-test/main/ctype_utf8mb4_heap.result @@ -971,6 +971,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +utf8mb4_general_ci +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 "BEGIN ctype_german.inc" drop table if exists t1; create table t1 as select repeat(' ', 64) as s1; @@ -1183,6 +1189,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +utf8mb4_bin +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 CREATE TABLE t1 ( user varchar(255) NOT NULL default '' ) ENGINE=heap DEFAULT CHARSET=latin1; diff --git a/mysql-test/main/ctype_utf8mb4_innodb.result b/mysql-test/main/ctype_utf8mb4_innodb.result index 82f0ddff1c4..baa22f0ffc4 100644 --- a/mysql-test/main/ctype_utf8mb4_innodb.result +++ b/mysql-test/main/ctype_utf8mb4_innodb.result @@ -1034,6 +1034,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +utf8mb4_general_ci +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 "BEGIN ctype_german.inc" drop table if exists t1; create table t1 as select repeat(' ', 64) as s1; @@ -1246,6 +1252,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +utf8mb4_bin +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 CREATE TABLE t1 ( user varchar(255) NOT NULL default '' ) ENGINE=InnoDB DEFAULT CHARSET=latin1; diff --git a/mysql-test/main/ctype_utf8mb4_myisam.result b/mysql-test/main/ctype_utf8mb4_myisam.result index 0bd13ef0282..67eef5856ec 100644 --- a/mysql-test/main/ctype_utf8mb4_myisam.result +++ b/mysql-test/main/ctype_utf8mb4_myisam.result @@ -1037,6 +1037,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +utf8mb4_general_ci +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 "BEGIN ctype_german.inc" drop table if exists t1; create table t1 as select repeat(' ', 64) as s1; @@ -1249,6 +1255,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +utf8mb4_bin +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 CREATE TABLE t1 ( user varchar(255) NOT NULL default '' ) ENGINE=MyISAM DEFAULT CHARSET=latin1; diff --git a/mysql-test/main/ddl_i18n_koi8r.result b/mysql-test/main/ddl_i18n_koi8r.result index f6e44a14f9d..612a4a4cbff 100644 --- a/mysql-test/main/ddl_i18n_koi8r.result +++ b/mysql-test/main/ddl_i18n_koi8r.result @@ -2183,6 +2183,8 @@ COLLATION(_utf8 'текÑÑ‚') AS c4, @@collation_connection AS c5, @@character_set_client AS c6; END| +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. CREATE EVENT ev2 ON SCHEDULE AT '1970-01-02 00:00:00' ON COMPLETION PRESERVE DISABLE DO BEGIN @@ -2195,6 +2197,8 @@ COLLATION(_utf8 'текÑÑ‚') AS c4, @@collation_connection AS c5, @@character_set_client AS c6; END| +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. CREATE EVENT mysqltest2.ev3 ON SCHEDULE AT '1970-01-02 00:00:00' ON COMPLETION PRESERVE DISABLE DO BEGIN @@ -2207,6 +2211,8 @@ COLLATION(_utf8 'текÑÑ‚') AS c4, @@collation_connection AS c5, @@character_set_client AS c6; END| +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. CREATE EVENT mysqltest2.ev4 ON SCHEDULE AT '1970-01-02 00:00:00' ON COMPLETION PRESERVE DISABLE DO BEGIN @@ -2219,6 +2225,8 @@ COLLATION(_utf8 'текÑÑ‚') AS c4, @@collation_connection AS c5, @@character_set_client AS c6; END| +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. diff --git a/mysql-test/main/ddl_i18n_utf8.result b/mysql-test/main/ddl_i18n_utf8.result index 2021a552f69..2be5413f182 100644 --- a/mysql-test/main/ddl_i18n_utf8.result +++ b/mysql-test/main/ddl_i18n_utf8.result @@ -2183,6 +2183,8 @@ COLLATION(_koi8r 'ÔÅËÓÔ') AS c4, @@collation_connection AS c5, @@character_set_client AS c6; END| +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. CREATE EVENT ev2 ON SCHEDULE AT '1970-01-02 00:00:00' ON COMPLETION PRESERVE DISABLE DO BEGIN @@ -2195,6 +2197,8 @@ COLLATION(_koi8r 'ÔÅËÓÔ') AS c4, @@collation_connection AS c5, @@character_set_client AS c6; END| +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. CREATE EVENT mysqltest2.ev3 ON SCHEDULE AT '1970-01-02 00:00:00' ON COMPLETION PRESERVE DISABLE DO BEGIN @@ -2207,6 +2211,8 @@ COLLATION(_koi8r 'ÔÅËÓÔ') AS c4, @@collation_connection AS c5, @@character_set_client AS c6; END| +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. CREATE EVENT mysqltest2.ev4 ON SCHEDULE AT '1970-01-02 00:00:00' ON COMPLETION PRESERVE DISABLE DO BEGIN @@ -2219,6 +2225,8 @@ COLLATION(_koi8r 'ÔÅËÓÔ') AS c4, @@collation_connection AS c5, @@character_set_client AS c6; END| +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. diff --git a/mysql-test/main/derived_cond_pushdown.result b/mysql-test/main/derived_cond_pushdown.result index 54068c4d6dd..5133b63f011 100644 --- a/mysql-test/main/derived_cond_pushdown.result +++ b/mysql-test/main/derived_cond_pushdown.result @@ -7884,7 +7884,7 @@ EXPLAIN "access_type": "ALL", "rows": 3, "filtered": 100, - "attached_condition": "sq.i = 2.7100000381469727", + "attached_condition": "sq.i = 2.71", "materialized": { "query_block": { "select_id": 2, @@ -10497,6 +10497,56 @@ a b max_d c 1 2 3 1 5 6 1 5 DROP TABLE t1,t2; +# +# MDEV-19139: pushdown condition with Item_func_set_user_var +# +CREATE TABLE t1 (a INT, b INT); +CREATE VIEW v1 AS SELECT a, MAX(b) FROM t1 GROUP BY a; +SELECT * FROM (SELECT 1 FROM v1 UNION (SELECT 1 FROM v1 WHERE @a := uuid())) dt; +1 +EXPLAIN FORMAT=JSON +SELECT * FROM (SELECT 1 FROM v1 UNION (SELECT 1 FROM v1 WHERE @a := uuid())) dt; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "materialized": { + "query_block": { + "union_result": { + "table_name": "<union2,3>", + "access_type": "ALL", + "query_specifications": [ + { + "query_block": { + "select_id": 2, + "table": { + "message": "no matching row in const table" + } + } + }, + { + "query_block": { + "select_id": 3, + "operation": "UNION", + "table": { + "message": "no matching row in const table" + } + } + } + ] + } + } + } + } + } +} +DROP TABLE t1; +DROP VIEW v1; # End of 10.2 tests # # MDEV-14579: pushdown conditions into materialized views/derived tables diff --git a/mysql-test/main/derived_cond_pushdown.test b/mysql-test/main/derived_cond_pushdown.test index ebbda849afa..05bc00dc28d 100644 --- a/mysql-test/main/derived_cond_pushdown.test +++ b/mysql-test/main/derived_cond_pushdown.test @@ -2124,6 +2124,20 @@ WHERE t1.a=tab.c AND DROP TABLE t1,t2; +--echo # +--echo # MDEV-19139: pushdown condition with Item_func_set_user_var +--echo # + +CREATE TABLE t1 (a INT, b INT); +CREATE VIEW v1 AS SELECT a, MAX(b) FROM t1 GROUP BY a; + +SELECT * FROM (SELECT 1 FROM v1 UNION (SELECT 1 FROM v1 WHERE @a := uuid())) dt; +EXPLAIN FORMAT=JSON +SELECT * FROM (SELECT 1 FROM v1 UNION (SELECT 1 FROM v1 WHERE @a := uuid())) dt; + +DROP TABLE t1; +DROP VIEW v1; + --echo # End of 10.2 tests --echo # diff --git a/mysql-test/main/dyncol.result b/mysql-test/main/dyncol.result index cc9a94e74be..5eff4a0a18a 100644 --- a/mysql-test/main/dyncol.result +++ b/mysql-test/main/dyncol.result @@ -501,12 +501,12 @@ select column_get(column_create(1, "1223.5555" AS double), 1 as double(5,2)); column_get(column_create(1, "1223.5555" AS double), 1 as double(5,2)) 999.99 Warnings: -Warning 1264 Out of range value for column 'column_get(column_create(1, "1223.5555" AS double), 1 as double(5,2))' at row 1 +Note 1264 Out of range value for column 'column_get(column_create(1, "1223.5555" AS double), 1 as double(5,2))' at row 1 select column_get(column_create(1, "1223.5555" AS double), 1 as double(3,2)); column_get(column_create(1, "1223.5555" AS double), 1 as double(3,2)) 9.99 Warnings: -Warning 1264 Out of range value for column 'column_get(column_create(1, "1223.5555" AS double), 1 as double(3,2))' at row 1 +Note 1264 Out of range value for column 'column_get(column_create(1, "1223.5555" AS double), 1 as double(3,2))' at row 1 # # column get decimal # diff --git a/mysql-test/main/events_1.result b/mysql-test/main/events_1.result index 6f3ad654810..26611abb880 100644 --- a/mysql-test/main/events_1.result +++ b/mysql-test/main/events_1.result @@ -13,7 +13,11 @@ USE db_x; CREATE TABLE x_table(a int); connect priv_conn,localhost,pauline,,db_x; CREATE EVENT e_x1 ON SCHEDULE EVERY 1 SECOND DO DROP DATABASE db_x; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. CREATE EVENT e_x2 ON SCHEDULE EVERY 1 SECOND DO DROP TABLE x_table; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. connection default; SHOW DATABASES LIKE 'db_x'; Database (db_x) @@ -39,6 +43,8 @@ drop event if exists event1; Warnings: Note 1305 Event event1 does not exist create event event1 on schedule every 15 minute starts now() ends date_add(now(), interval 5 hour) DO begin end; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. alter event event1 rename to event2 enable; alter event event2 disable; alter event event2 enable; @@ -47,8 +53,12 @@ alter event event2 on schedule every 1 year on completion preserve rename to eve alter event event3 rename to event2; drop event event2; create event event2 on schedule every 2 second starts now() ends date_add(now(), interval 5 hour) comment "some" DO begin end; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. drop event event2; CREATE EVENT event_starts_test ON SCHEDULE EVERY 10 SECOND COMMENT "" DO SELECT 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SELECT interval_field, interval_value, body FROM mysql.event WHERE db='events_test' AND name='event_starts_test'; interval_field interval_value body SECOND 10 SELECT 1 @@ -69,6 +79,8 @@ execute_at IS NULL starts IS NULL ends IS NULL comment 0 1 1 DROP EVENT event_starts_test; CREATE EVENT event_starts_test ON SCHEDULE EVERY 20 SECOND STARTS '1970-01-02 00:00:00' ENDS '1970-01-03 00:00:00' ON COMPLETION PRESERVE DISABLE DO SELECT 2; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SELECT execute_at IS NULL, starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test'; execute_at IS NULL starts IS NULL ends IS NULL comment 1 0 0 @@ -83,6 +95,8 @@ execute_at IS NULL starts IS NULL ends IS NULL comment DROP EVENT event_starts_test; create table test_nested(a int); create event e_43 on schedule every 1 second do set @a = 5; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. alter event e_43 do alter event e_43 do set @a = 4; ERROR HY000: Recursion of EVENT DDL statements is forbidden when body is present alter event e_43 do @@ -111,6 +125,8 @@ alter event non_existant rename to non_existant_too; ERROR HY000: Unknown event 'non_existant' set global event_scheduler = off; create event existant on schedule at now() + interval 1 year do select 12; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. alter event non_existant rename to existant; ERROR HY000: Event 'existant' already exists alter event existant rename to events_test.existant; @@ -121,6 +137,8 @@ drop event if exists event3; Warnings: Note 1305 Event event3 does not exist create event event3 on schedule every 50 + 10 minute starts date_add(curdate(), interval 5 minute) ends date_add(curdate(), interval 5 day) comment "portokala_comment" DO insert into t_event3 values (unix_timestamp(), rand()); +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. select count(*) from t_event3; count(*) 0 @@ -128,79 +146,117 @@ drop event event3; drop table t_event3; set names utf8; CREATE EVENT root6 ON SCHEDULE EVERY '10:20' MINUTE_SECOND ON COMPLETION PRESERVE ENABLE COMMENT 'some comment' DO select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW CREATE EVENT root6; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation root6 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `root6` ON SCHEDULE EVERY '10:20' MINUTE_SECOND STARTS '#' ON COMPLETION PRESERVE ENABLE COMMENT 'some comment' DO select 1 utf8 utf8_general_ci latin1_swedish_ci create event root7 on schedule every 2 year do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW CREATE EVENT root7; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation root7 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `root7` ON SCHEDULE EVERY 2 YEAR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci create event root8 on schedule every '2:5' year_month do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW CREATE EVENT root8; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation root8 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `root8` ON SCHEDULE EVERY '2-5' YEAR_MONTH STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci create event root8_1 on schedule every '2:15' year_month do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW CREATE EVENT root8_1; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation root8_1 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `root8_1` ON SCHEDULE EVERY '3-3' YEAR_MONTH STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci create event root9 on schedule every 2 week ON COMPLETION PRESERVE DISABLE COMMENT 'коментар на кирилица' do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW CREATE EVENT root9; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation root9 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `root9` ON SCHEDULE EVERY 2 WEEK STARTS '#' ON COMPLETION PRESERVE DISABLE COMMENT 'коментар на кирилица' DO select 1 utf8 utf8_general_ci latin1_swedish_ci create event root10 on schedule every '20:5' day_hour do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW CREATE EVENT root10; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation root10 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `root10` ON SCHEDULE EVERY '20 5' DAY_HOUR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci create event root11 on schedule every '20:25' day_hour do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW CREATE EVENT root11; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation root11 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `root11` ON SCHEDULE EVERY '21 1' DAY_HOUR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci create event root12 on schedule every '20:25' hour_minute do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW CREATE EVENT root12; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation root12 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `root12` ON SCHEDULE EVERY '20:25' HOUR_MINUTE STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci create event root13 on schedule every '25:25' hour_minute do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW CREATE EVENT root13; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation root13 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `root13` ON SCHEDULE EVERY '25:25' HOUR_MINUTE STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci create event root13_1 on schedule every '11:65' hour_minute do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW CREATE EVENT root13_1; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation root13_1 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `root13_1` ON SCHEDULE EVERY '12:5' HOUR_MINUTE STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci create event root14 on schedule every '35:35' minute_second do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW CREATE EVENT root14; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation root14 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `root14` ON SCHEDULE EVERY '35:35' MINUTE_SECOND STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci create event root15 on schedule every '35:66' minute_second do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW CREATE EVENT root15; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation root15 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `root15` ON SCHEDULE EVERY '36:6' MINUTE_SECOND STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci create event root16 on schedule every '35:56' day_minute do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW CREATE EVENT root16; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation root16 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `root16` ON SCHEDULE EVERY '1 11:56' DAY_MINUTE STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci create event root17 on schedule every '35:12:45' day_minute do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW CREATE EVENT root17; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation root17 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `root17` ON SCHEDULE EVERY '35 12:45' DAY_MINUTE STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci create event root17_1 on schedule every '35:25:65' day_minute do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW CREATE EVENT root17_1; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation root17_1 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `root17_1` ON SCHEDULE EVERY '36 2:5' DAY_MINUTE STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci create event root18 on schedule every '35:12:45' hour_second do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW CREATE EVENT root18; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation root18 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `root18` ON SCHEDULE EVERY '35:12:45' HOUR_SECOND STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci create event root19 on schedule every '15:59:85' hour_second do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW CREATE EVENT root19; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation root19 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `root19` ON SCHEDULE EVERY '16:0:25' HOUR_SECOND STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci create event root20 on schedule every '50:20:12:45' day_second do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW CREATE EVENT root20; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation root20 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `root20` ON SCHEDULE EVERY '50 20:12:45' DAY_SECOND STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci set names cp1251; create event ðóóò21 on schedule every '50:23:59:95' day_second COMMENT 'òîâà å 1251 êîìåíòàð' do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW CREATE EVENT ðóóò21; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation ðóóò21 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `руут21` ON SCHEDULE EVERY '51 0:0:35' DAY_SECOND STARTS '#' ON COMPLETION NOT PRESERVE ENABLE COMMENT 'това е 1251 коментар' DO select 1 cp1251 cp1251_general_ci latin1_swedish_ci @@ -260,6 +316,8 @@ set names latin1; Create a test event. Only event metadata is relevant, the actual schedule and body are not. CREATE EVENT intact_check ON SCHEDULE EVERY 10 HOUR DO SELECT "nothing"; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW EVENTS; Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation events_test intact_check root@localhost SYSTEM RECURRING NULL 10 # # NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci @@ -306,6 +364,8 @@ SET GLOBAL event_scheduler=OFF; ALTER TABLE mysql.event DROP dummy; DROP EVENT intact_check; CREATE EVENT intact_check ON SCHEDULE EVERY 10 HOUR DO SELECT "nothing"; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. Now let's add a column to the first position: the server expects to see event schema name there @@ -349,6 +409,8 @@ Clean up ALTER TABLE mysql.event DROP dummy; DELETE FROM mysql.event; CREATE EVENT intact_check ON SCHEDULE EVERY 10 HOUR DO SELECT "nothing"; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. Back up the table, further changes are not reversible CREATE TABLE event_like LIKE mysql.event; INSERT INTO event_like SELECT * FROM mysql.event; @@ -447,6 +509,8 @@ Db Name Definer Time zone Type Execute at Interval value Interval field Starts E # CREATE EVENT ev1 ON SCHEDULE EVERY 5 HOUR DO SELECT 5; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. ALTER EVENT ev1 ON SCHEDULE EVERY 8 HOUR DO SELECT 8; CREATE TABLE event_original LIKE mysql.event; @@ -480,6 +544,8 @@ Db Name Definer Time zone Type Execute at Interval value Interval field Starts E # CREATE TABLE t1 (a INT); CREATE EVENT ev1 ON SCHEDULE EVERY 5 SECOND DO DELETE FROM t1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW EVENTS; Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation events_test ev1 root@localhost SYSTEM RECURRING NULL 5 # # NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci @@ -489,6 +555,8 @@ Db Name Definer Time zone Type Execute at Interval value Interval field Starts E events_test ev1 root@localhost SYSTEM RECURRING NULL 5 # # NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci DROP EVENT ev1; CREATE EVENT ev1 ON SCHEDULE EVERY 5 SECOND DO DELETE FROM t1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW EVENTS; Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation events_test ev1 root@localhost SYSTEM RECURRING NULL 5 # # NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci diff --git a/mysql-test/main/events_2.result b/mysql-test/main/events_2.result index 6d2ebda03d0..6dd1a9e5dc6 100644 --- a/mysql-test/main/events_2.result +++ b/mysql-test/main/events_2.result @@ -3,6 +3,8 @@ drop database if exists events_test; create database events_test; use events_test; create event e_26 on schedule at '2037-01-01 00:00:00' disable do set @a = 5; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. select db, name, body, definer, convert_tz(execute_at, 'UTC', 'SYSTEM'), on_completion from mysql.event; db name body definer convert_tz(execute_at, 'UTC', 'SYSTEM') on_completion events_test e_26 set @a = 5 root@localhost 2037-01-01 00:00:00 DROP @@ -13,6 +15,8 @@ create event e_26 on schedule at 'definitely not a datetime' disable do set @a = ERROR HY000: Incorrect AT value: 'definitely not a datetime' set names utf8; create event задачка on schedule every 123 minute starts now() ends now() + interval 1 month do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. drop event задачка; "DISABLE the scheduler. Testing that it does not work when the variable is 0" set global event_scheduler=off; @@ -22,6 +26,8 @@ select get_lock("test_lock1", 20); get_lock("test_lock1", 20) 1 create event закачка on schedule every 10 hour do select get_lock("test_lock1", 20); +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. "Should return 1 row" select definer, name, db from mysql.event; definer name db @@ -94,22 +100,30 @@ on schedule every 10 hour disable do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. select event_schema, event_name, definer, event_definition from information_schema.events where event_name='white_space'; event_schema event_name definer event_definition events_test white_space root@localhost select 1 drop event white_space; create event white_space on schedule every 10 hour disable do select 2; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. select event_schema, event_name, definer, event_definition from information_schema.events where event_name='white_space'; event_schema event_name definer event_definition events_test white_space root@localhost select 2 drop event white_space; create event white_space on schedule every 10 hour disable do select 3; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. select event_schema, event_name, definer, event_definition from information_schema.events where event_name='white_space'; event_schema event_name definer event_definition events_test white_space root@localhost select 3 drop event white_space; create event e1 on schedule every 1 year do set @a = 5; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. create table t1 (s1 int); create trigger t1_ai after insert on t1 for each row show create event e1; ERROR 0A000: Not allowed to return a result set from a trigger @@ -126,6 +140,8 @@ LOCK TABLES mode. create table t1 (a int); create event e1 on schedule every 10 hour do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. lock table t1 read; show create event e1; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation @@ -229,6 +245,8 @@ Events in sub-statements, events and prelocking create event e1 on schedule every 10 hour do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. create function f1() returns int begin show create event e1; @@ -321,6 +339,8 @@ drop table t1| drop event e1| set names utf8; create event имÑ_ÑобытиÑ_в_кодировке_утф8_длиной_больше_чем_48 on schedule every 2 year do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. select EVENT_NAME from information_schema.events where event_schema='test'; EVENT_NAME @@ -333,6 +353,8 @@ create event event_35981 on schedule every 6 month on completion preserve disable do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. The following SELECTs should all give 1 select count(*) from information_schema.events where event_schema = database() and event_name = 'event_35981' and @@ -367,6 +389,8 @@ drop event event_35981; create event event_35981 on schedule every 6 month disable do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. select count(*) from information_schema.events where event_schema = database() and event_name = 'event_35981' and on_completion = 'NOT PRESERVE'; @@ -377,6 +401,8 @@ create event event_35981 on schedule every 1 hour starts current_timestamp on completion not preserve do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. alter event event_35981 on schedule every 1 hour starts '1999-01-01 00:00:00' ends '1999-01-02 00:00:00'; ERROR HY000: Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was not changed. Specify a time in the future @@ -385,6 +411,8 @@ create event event_35981 on schedule every 1 hour starts current_timestamp on completion not preserve do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. alter event event_35981 on schedule every 1 hour starts '1999-01-01 00:00:00' ends '1999-01-02 00:00:00' on completion preserve; Warnings: @@ -394,6 +422,8 @@ create event event_35981 on schedule every 1 hour starts current_timestamp on completion preserve do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. alter event event_35981 on schedule every 1 hour starts '1999-01-01 00:00:00' ends '1999-01-02 00:00:00'; Warnings: diff --git a/mysql-test/main/events_bugs.result b/mysql-test/main/events_bugs.result index 3e770451735..008d4db7dae 100644 --- a/mysql-test/main/events_bugs.result +++ b/mysql-test/main/events_bugs.result @@ -11,16 +11,22 @@ VARIABLE_NAME VARIABLE_VALUE EVENT_SCHEDULER ON SET GLOBAL event_scheduler = 'OFF'; CREATE EVENT lower_case ON SCHEDULE EVERY 1 MINUTE DO SELECT 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. CREATE EVENT Lower_case ON SCHEDULE EVERY 2 MINUTE DO SELECT 2; ERROR HY000: Event 'Lower_case' already exists DROP EVENT Lower_case; SET NAMES cp1251; CREATE EVENT äîëåí_ðåãèñòúð_1251 ON SCHEDULE EVERY 1 YEAR DO SELECT 100; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. CREATE EVENT ÄîËåÍ_ðåãèñòúð_1251 ON SCHEDULE EVERY 2 YEAR DO SELECT 200; ERROR HY000: Event 'ÄîËåÍ_ðåãèñòúð_1251' already exists DROP EVENT ÄîËåÍ_ðåãèñòúð_1251; SET NAMES utf8; CREATE EVENT долен_региÑÑ‚ÑŠÑ€_утф8 ON SCHEDULE EVERY 3 YEAR DO SELECT 300; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. CREATE EVENT ДОЛЕÐ_региÑÑ‚ÑŠÑ€_утф8 ON SCHEDULE EVERY 4 YEAR DO SELECT 400; ERROR HY000: Event 'ДОЛЕÐ_региÑÑ‚ÑŠÑ€_утф8' already exists DROP EVENT ДОЛЕÐ_региÑÑ‚ÑŠÑ€_утф8; @@ -205,6 +211,8 @@ create database mysqltest_db1; grant event on events_test.* to mysqltest_user1@localhost; connect conn2,localhost,mysqltest_user1,,events_test; create event mysqltest_user1 on schedule every 10 second do select 42; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. alter event mysqltest_user1 rename to mysqltest_db1.mysqltest_user1; ERROR 42000: Access denied for user 'mysqltest_user1'@'localhost' to database 'mysqltest_db1' "Let's test now rename when there is no select DB" @@ -234,6 +242,8 @@ ERROR 42000: CREATE/ALTER EVENT does not support subqueries or stored functions drop event if exists e_16; drop procedure if exists p_16; create event e_16 on schedule every 1 second do set @a=5; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. create procedure p_16 () alter event e_16 on schedule every @a second; set @a = null; call p_16(); @@ -347,11 +357,15 @@ DROP USER mysqltest_u1@localhost; CREATE USER mysqltest_u1@localhost; GRANT EVENT ON events_test.* TO mysqltest_u1@localhost; CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SELECT event_name, definer FROM INFORMATION_SCHEMA.EVENTS; event_name definer e1 root@localhost DROP EVENT e1; CREATE DEFINER=CURRENT_USER EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SELECT event_name, definer FROM INFORMATION_SCHEMA.EVENTS; event_name definer e1 root@localhost @@ -361,23 +375,31 @@ event_name definer e1 mysqltest_u1@localhost DROP EVENT e1; CREATE DEFINER=CURRENT_USER() EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SELECT event_name, definer FROM INFORMATION_SCHEMA.EVENTS; event_name definer e1 root@localhost DROP EVENT e1; CREATE DEFINER=mysqltest_u1@localhost EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SELECT event_name, definer FROM INFORMATION_SCHEMA.EVENTS; event_name definer e1 mysqltest_u1@localhost DROP EVENT e1; connect conn1, localhost, mysqltest_u1, , events_test; CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SELECT event_name, definer FROM INFORMATION_SCHEMA.EVENTS; event_name definer e1 mysqltest_u1@localhost DROP EVENT e1; CREATE DEFINER=CURRENT_USER EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SELECT event_name, definer FROM INFORMATION_SCHEMA.EVENTS; event_name definer e1 mysqltest_u1@localhost @@ -388,6 +410,8 @@ event_name definer e1 mysqltest_u1@localhost DROP EVENT e1; CREATE DEFINER=CURRENT_USER() EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SELECT event_name, definer FROM INFORMATION_SCHEMA.EVENTS; event_name definer e1 mysqltest_u1@localhost @@ -404,6 +428,8 @@ SET @save_time_zone= @@TIME_ZONE; SET TIME_ZONE= '+00:00'; SET TIMESTAMP= UNIX_TIMESTAMP('2005-12-31 23:58:59'); CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW EVENTS; Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation events_test e1 root@localhost +00:00 RECURRING NULL 1 DAY 2005-12-31 23:58:59 NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci @@ -433,14 +459,20 @@ DROP EVENT e1; SET TIME_ZONE='+05:00'; CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY STARTS '2006-01-01 00:00:00' DO SELECT 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SET TIMESTAMP= @@TIMESTAMP + 1; SET TIME_ZONE='-05:00'; CREATE EVENT e2 ON SCHEDULE EVERY 1 DAY STARTS '2006-01-01 00:00:00' DO SELECT 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SET TIMESTAMP= @@TIMESTAMP + 1; SET TIME_ZONE='+00:00'; CREATE EVENT e3 ON SCHEDULE EVERY 1 DAY STARTS '2006-01-01 00:00:00' DO SELECT 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SELECT * FROM INFORMATION_SCHEMA.EVENTS ORDER BY event_name; EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER TIME_ZONE EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD SQL_MODE STARTS ENDS STATUS ON_COMPLETION CREATED LAST_ALTERED LAST_EXECUTED EVENT_COMMENT ORIGINATOR CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION def events_test e1 root@localhost +05:00 SQL SELECT 1 RECURRING NULL 1 DAY 2006-01-01 00:00:00 NULL ENABLED NOT PRESERVE 2005-12-31 23:58:59 2005-12-31 23:58:59 NULL 1 latin1 latin1_swedish_ci latin1_swedish_ci @@ -505,26 +537,34 @@ DO SELECT 1; Warnings: Note 1544 Event execution time is in the past. Event has been disabled +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. CREATE EVENT e5 ON SCHEDULE AT '1999-01-01 00:00:00' ON COMPLETION PRESERVE DO SELECT 1; Warnings: Note 1544 Event execution time is in the past. Event has been disabled +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. The following should succeed without warnings. ALTER EVENT e2 ON SCHEDULE EVERY 1 HOUR STARTS '1999-01-01 00:00:00'; ALTER EVENT e3 ON SCHEDULE EVERY 1 HOUR STARTS '1999-01-01 00:00:00' ENDS '1999-01-02 00:00:00' ON COMPLETION PRESERVE DISABLE; CREATE EVENT e6 ON SCHEDULE EVERY 1 HOUR STARTS '1999-01-01 00:00:00' DO SELECT 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. CREATE EVENT e7 ON SCHEDULE EVERY 1 HOUR STARTS '1999-01-01 00:00:00' ENDS '1999-01-02 00:00:00' ON COMPLETION PRESERVE DISABLE DO SELECT 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. CREATE EVENT e8 ON SCHEDULE AT '1999-01-01 00:00:00' ON COMPLETION PRESERVE DISABLE DO SELECT 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW EVENTS; Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation events_test e1 root@localhost +00:00 RECURRING NULL 1 HOUR 1999-01-01 00:00:00 1999-01-02 00:00:00 DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci @@ -663,6 +703,8 @@ ERROR HY000: The MariaDB server is running with the --read-only option so it can connect root_con,localhost,root,,events_test; CREATE EVENT e1 ON SCHEDULE AT '2020-01-01 00:00:00' DO SET @a = 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. ALTER EVENT e1 COMMENT 'comment'; @@ -673,7 +715,11 @@ SET GLOBAL READ_ONLY = 0; connection u1_con; CREATE EVENT e1 ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 SECOND DO SET @a = 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. CREATE EVENT e2 ON SCHEDULE EVERY 1 SECOND DO SET @a = 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SELECT event_name, @@ -731,6 +777,8 @@ drop procedure if exists p; set @old_mode= @@sql_mode; set @@sql_mode= cast(pow(2,32)-1 as unsigned integer); create event e1 on schedule every 1 day do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. select @@sql_mode into @full_mode; set @@sql_mode= @old_mode; select replace(@full_mode, 'ALLOW_INVALID_DATES', 'INVALID_DATES') into @full_mode; @@ -744,6 +792,8 @@ SELECT @@GLOBAL.server_id; @@GLOBAL.server_id 4294967295 CREATE EVENT ev1 ON SCHEDULE EVERY 1 DAY DO SELECT 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SELECT event_name, originator FROM INFORMATION_SCHEMA.EVENTS; event_name originator ev1 4294967295 @@ -752,6 +802,8 @@ SET GLOBAL server_id = @old_server_id; CREATE DATABASE event_test12; USE event_test12; CREATE EVENT ev1 ON SCHEDULE EVERY 1 DAY DO SELECT 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. CREATE DATABASE event_test1; USE event_test1; SHOW EVENTS; @@ -801,6 +853,8 @@ DROP DATABASE IF EXISTS event_test11764334; CREATE DATABASE event_test11764334; USE event_test11764334; CREATE EVENT ev1 ON SCHEDULE EVERY 3 SECOND DISABLE DO SELECT 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW EVENTS IN event_test11764334 WHERE NAME='ev1'; Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation event_test11764334 ev1 root@localhost SYSTEM RECURRING NULL 3 SECOND # # DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci diff --git a/mysql-test/main/events_grant.result b/mysql-test/main/events_grant.result index cc7796975a6..c4f459dbe5b 100644 --- a/mysql-test/main/events_grant.result +++ b/mysql-test/main/events_grant.result @@ -1,6 +1,8 @@ CREATE DATABASE IF NOT EXISTS events_test; use events_test; CREATE EVENT one_event ON SCHEDULE EVERY 10 SECOND DO SELECT 123; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW EVENTS; Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation events_test one_event root@localhost SYSTEM RECURRING NULL 10 # # NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci @@ -38,7 +40,11 @@ Let's create some new events from the name of ev_test@localhost CREATE EVENT one_event ON SCHEDULE EVERY 20 SECOND DO SELECT 123; ERROR HY000: Event 'one_event' already exists CREATE EVENT two_event ON SCHEDULE EVERY 20 SECOND ON COMPLETION NOT PRESERVE COMMENT "two event" DO SELECT 123; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. CREATE EVENT three_event ON SCHEDULE EVERY 20 SECOND ON COMPLETION PRESERVE COMMENT "three event" DO SELECT 123; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. "Now we should see 3 events:"; SHOW EVENTS; Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation @@ -58,6 +64,8 @@ GRANT EVENT ON events_test2.* TO ev_test@localhost; connection ev_con1; USE events_test2; CREATE EVENT four_event ON SCHEDULE EVERY 20 SECOND DO SELECT 42; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. connection default; USE events_test; "We should see 4 events : one_event, two_event, three_event & four_event" @@ -78,6 +86,8 @@ connection default; CREATE DATABASE events_test2; USE events_test2; CREATE EVENT five_event ON SCHEDULE EVERY 20 SECOND DO SELECT 42; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. connection ev_con1; "Should see 4 events - one, two, three & five" SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS ORDER BY EVENT_SCHEMA, EVENT_NAME; diff --git a/mysql-test/main/events_restart.result b/mysql-test/main/events_restart.result index 8c9c252018a..68343fcf994 100644 --- a/mysql-test/main/events_restart.result +++ b/mysql-test/main/events_restart.result @@ -6,10 +6,16 @@ use events_test; create table execution_log(name char(10)); create event abc1 on schedule every 1 second do insert into execution_log value('abc1'); +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. create event abc2 on schedule every 1 second do insert into execution_log value('abc2'); +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. create event abc3 on schedule every 1 second do insert into execution_log value('abc3'); +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. create table event_like like mysql.event; insert into event_like select * from mysql.event; alter table mysql.event @@ -21,25 +27,25 @@ select @@event_scheduler; @@event_scheduler OFF show events; -ERROR HY000: Cannot proceed because system tables used by Event Scheduler were found damaged at server start +ERROR HY000: Cannot proceed, because event scheduler is disabled select event_name from information_schema.events; -ERROR HY000: Cannot proceed because system tables used by Event Scheduler were found damaged at server start +ERROR HY000: Cannot proceed, because event scheduler is disabled show create event intact_check; -ERROR HY000: Cannot proceed because system tables used by Event Scheduler were found damaged at server start +ERROR HY000: Cannot proceed, because event scheduler is disabled drop event no_such_event; -ERROR HY000: Cannot proceed because system tables used by Event Scheduler were found damaged at server start +ERROR HY000: Cannot proceed, because event scheduler is disabled create event intact_check_1 on schedule every 5 hour do select 5; -ERROR HY000: Cannot proceed because system tables used by Event Scheduler were found damaged at server start +ERROR HY000: Cannot proceed, because event scheduler is disabled alter event intact_check_1 on schedule every 8 hour do select 8; -ERROR HY000: Cannot proceed because system tables used by Event Scheduler were found damaged at server start +ERROR HY000: Cannot proceed, because event scheduler is disabled alter event intact_check_1 rename to intact_check_2; -ERROR HY000: Cannot proceed because system tables used by Event Scheduler were found damaged at server start +ERROR HY000: Cannot proceed, because event scheduler is disabled drop event intact_check_1; -ERROR HY000: Cannot proceed because system tables used by Event Scheduler were found damaged at server start +ERROR HY000: Cannot proceed, because event scheduler is disabled drop event intact_check_2; -ERROR HY000: Cannot proceed because system tables used by Event Scheduler were found damaged at server start +ERROR HY000: Cannot proceed, because event scheduler is disabled drop event intact_check; -ERROR HY000: Cannot proceed because system tables used by Event Scheduler were found damaged at server start +ERROR HY000: Cannot proceed, because event scheduler is disabled set global event_scheduler=on; ERROR HY000: Event Scheduler: An error occurred when initializing system tables. Disabling the Event Scheduler. set global event_scheduler=off; diff --git a/mysql-test/main/events_stress.test b/mysql-test/main/events_stress.test index 8ea7633877b..080707f029f 100644 --- a/mysql-test/main/events_stress.test +++ b/mysql-test/main/events_stress.test @@ -21,6 +21,7 @@ GRANT ALL ON *.* TO event_user3@localhost; connect (conn2,localhost,event_user2,,events_conn2_db); --echo "In the second connection we create some events which won't be dropped till the end" --disable_query_log +--disable_warnings let $1= 50; while ($1) { diff --git a/mysql-test/main/events_trans.result b/mysql-test/main/events_trans.result index 873f0441089..a7b268fe2a7 100644 --- a/mysql-test/main/events_trans.result +++ b/mysql-test/main/events_trans.result @@ -15,6 +15,8 @@ create table t1 (a varchar(255)) engine=innodb; begin work; insert into t1 (a) values ("OK: create event"); create event e1 on schedule every 1 day do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. rollback work; select * from t1; a @@ -60,11 +62,14 @@ OK: drop event if exists delete from t1; commit work; create event e1 on schedule every 1 day do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. begin work; insert into t1 (a) values ("OK: create event if not exists"); create event if not exists e1 on schedule every 2 day do select 2; Warnings: Note 1537 Event 'e1' already exists +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. rollback work; select * from t1; a @@ -96,6 +101,8 @@ OK: alter event rename: rename to same name delete from t1; commit work; create event e2 on schedule every 3 day do select 3; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. begin work; insert into t1 (a) values ("OK: alter event rename: destination exists"); alter event e2 rename to e1; @@ -126,6 +133,8 @@ DROP EVENT IF EXISTS e1; CREATE TABLE t1 (a INT) ENGINE=InnoDB; CREATE TABLE t2 (a INT); CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. START TRANSACTION; INSERT INTO t1 VALUES (1); SAVEPOINT A; diff --git a/mysql-test/main/flush_logs_not_windows.result b/mysql-test/main/flush_logs_not_windows.result new file mode 100644 index 00000000000..920fddb8f97 --- /dev/null +++ b/mysql-test/main/flush_logs_not_windows.result @@ -0,0 +1,3 @@ +flush logs; +ERROR HY000: Can't create file 'MYSQLTEST_VARDIR/log/mysqld.1.err' (errno: 13 "Permission denied") +flush logs; diff --git a/mysql-test/main/flush_logs_not_windows.test b/mysql-test/main/flush_logs_not_windows.test new file mode 100644 index 00000000000..af50e4bb9e8 --- /dev/null +++ b/mysql-test/main/flush_logs_not_windows.test @@ -0,0 +1,13 @@ +source include/not_windows.inc; +source include/not_embedded.inc; +# +# MDEV-17710 "unknown error" with FLUSH LOGS if log directory is not writeable +# +move_file $MYSQLTEST_VARDIR/log/mysqld.1.err $MYSQLTEST_VARDIR/log/mysqld.1.err-bak; +system chmod u-w $MYSQLTEST_VARDIR/log; +replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR; +error ER_CANT_CREATE_FILE; +flush logs; +system chmod u+w $MYSQLTEST_VARDIR/log; +move_file $MYSQLTEST_VARDIR/log/mysqld.1.err-bak $MYSQLTEST_VARDIR/log/mysqld.1.err; +flush logs; diff --git a/mysql-test/main/flush_read_lock.result b/mysql-test/main/flush_read_lock.result index db92344cfbd..0f8c2ce9fb9 100644 --- a/mysql-test/main/flush_read_lock.result +++ b/mysql-test/main/flush_read_lock.result @@ -85,6 +85,8 @@ insert into t1_temp values (1); return 0; end| create event e1 on schedule every 1 minute do begin end; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. connect con1,localhost,root,,; connect con2,localhost,root,,; connect con3,localhost,root,,; diff --git a/mysql-test/main/func_gconcat.result b/mysql-test/main/func_gconcat.result index 1701bb364e8..79011b4fc5e 100644 --- a/mysql-test/main/func_gconcat.result +++ b/mysql-test/main/func_gconcat.result @@ -1,4 +1,3 @@ -drop table if exists t1, t2; create table t1 (grp int, a bigint unsigned, c char(10) not null, d char(10) not null); insert into t1 values (1,1,"a","a"); insert into t1 values (2,2,"b","a"); @@ -1200,6 +1199,35 @@ Warning 1260 Row 3 was cut by GROUP_CONCAT() Warning 1260 Row 5 was cut by GROUP_CONCAT() DROP TABLE t1; SET group_concat_max_len= DEFAULT; +set session group_concat_max_len=1024; +set max_session_mem_used=16*1024*1024; +SELECT GROUP_CONCAT(concat(seq/1.1), concat(seq/1.1), concat(seq/1.1), concat(seq/1.1), concat(seq/1.1), concat(seq/1.1), concat(seq/1.1), concat(seq/1.1) ORDER BY 2,1,3,4,6,5,8,7) AS c +FROM seq_1_to_200000; +c +0.90910.90910.90910.90910.90910.90910.90910.9091,1.81821.81821.81821.81821.81821.81821.81821.8182,10.000010.000010.000010.000010.000010.000010.000010.0000,10.909110.909110.909110.909110.909110.909110.909110.9091,100.0000100.0000100.0000100.0000100.0000100.0000100.0000100.0000,100.9091100.9091100.9091100.9091100.9091100.9091100.9091100.9091,1000.00001000.00001000.00001000.00001000.00001000.00001000.00001000.0000,1000.90911000.90911000.90911000.90911000.90911000.90911000.90911000.9091,10000.000010000.000010000.000010000.000010000.000010000.000010000.000010000.0000,10000.909110000.909110000.909110000.909110000.909110000.909110000.909110000.9091,100000.0000100000.0000100000.0000100000.0000100000.0000100000.0000100000.0000100000.0000,100000.9091100000.9091100000.9091100000.9091100000.9091100000.9091100000.9091100000.9091,100001.8182100001.8182100001.8182100001.8182100001.8182100001.8182100001.8182100001.8182,100002.7273100002.7273100002.7273100002.7273100002.7273100002.7273100002.7273100002.7273,100003.6364100003. +Warnings: +Warning 1260 Row 15 was cut by GROUP_CONCAT() +set max_session_mem_used=default; +set session group_concat_max_len=default; +SET group_concat_max_len= 8; +CREATE TABLE t1 (a INT); +INSERT t1 VALUES (1),(2); +CREATE TABLE t2 (b DATE, c INT); +INSERT t2 VALUES ('2019-12-04',1),('2020-03-28',2); +CREATE TABLE t3 (d INT); +INSERT t3 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14); +CREATE TABLE t4 (e INT); +INSERT t4 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14),(15); +SELECT (SELECT MAX(a) FROM t1 WHERE t2_sq.c > 0) AS f, +GROUP_CONCAT(t2_sq.b ORDER BY 1) AS gc +FROM (SELECT t2_a.* FROM t2 AS t2_a, t2 AS t2_b) AS t2_sq, t3, t4 +GROUP BY f; +f gc +2 2019-12- +Warnings: +Warning 1260 Row 1 was cut by GROUP_CONCAT() +DROP TABLE t1, t2, t3, t4; +SET group_concat_max_len= default; # # Start of 10.2 tests # diff --git a/mysql-test/main/func_gconcat.test b/mysql-test/main/func_gconcat.test index b8ab96bdea4..a76568bdae3 100644 --- a/mysql-test/main/func_gconcat.test +++ b/mysql-test/main/func_gconcat.test @@ -1,9 +1,7 @@ # # simple test of group_concat function # ---disable_warnings -drop table if exists t1, t2; ---enable_warnings +source include/have_sequence.inc; create table t1 (grp int, a bigint unsigned, c char(10) not null, d char(10) not null); insert into t1 values (1,1,"a","a"); @@ -874,6 +872,35 @@ SELECT LENGTH(GROUP_CONCAT(f1 ORDER BY f2)) FROM t1 GROUP BY f2; DROP TABLE t1; SET group_concat_max_len= DEFAULT; +# +# MDEV-9531 GROUP_CONCAT with ORDER BY inside takes a lot of memory while it's executed +# +set session group_concat_max_len=1024; +set max_session_mem_used=16*1024*1024; # 8M..32M +SELECT GROUP_CONCAT(concat(seq/1.1), concat(seq/1.1), concat(seq/1.1), concat(seq/1.1), concat(seq/1.1), concat(seq/1.1), concat(seq/1.1), concat(seq/1.1) ORDER BY 2,1,3,4,6,5,8,7) AS c +FROM seq_1_to_200000; +set max_session_mem_used=default; +set session group_concat_max_len=default; + +# +# MDEV-19350 Server crashes in delete_tree_element / ... / Item_func_group_concat::repack_tree +# +SET group_concat_max_len= 8; +CREATE TABLE t1 (a INT); +INSERT t1 VALUES (1),(2); +CREATE TABLE t2 (b DATE, c INT); +INSERT t2 VALUES ('2019-12-04',1),('2020-03-28',2); +CREATE TABLE t3 (d INT); +INSERT t3 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14); +CREATE TABLE t4 (e INT); +INSERT t4 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14),(15); +SELECT (SELECT MAX(a) FROM t1 WHERE t2_sq.c > 0) AS f, + GROUP_CONCAT(t2_sq.b ORDER BY 1) AS gc +FROM (SELECT t2_a.* FROM t2 AS t2_a, t2 AS t2_b) AS t2_sq, t3, t4 +GROUP BY f; +DROP TABLE t1, t2, t3, t4; +SET group_concat_max_len= default; + --echo # --echo # Start of 10.2 tests diff --git a/mysql-test/main/func_hybrid_type.result b/mysql-test/main/func_hybrid_type.result index 91f3949d456..664a872cf4c 100644 --- a/mysql-test/main/func_hybrid_type.result +++ b/mysql-test/main/func_hybrid_type.result @@ -3448,6 +3448,36 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; # +# MDEV-11015 Assertion failed: precision > 0 in decimal_bin_size upon SELECT with DISTINCT, CAST and other functions +# +CREATE TABLE t1 (b LONGBLOB); +INSERT IGNORE INTO t1 VALUES ('foo'),('bar'); +SELECT DISTINCT - GREATEST( b, CAST( NULL AS DATETIME ) ) AS f FROM t1; +f +NULL +Warnings: +Warning 1292 Truncated incorrect datetime value: 'foo' +Warning 1292 Truncated incorrect datetime value: 'bar' +DROP TABLE t1; +CREATE TABLE t1 (b LONGBLOB); +INSERT IGNORE INTO t1 VALUES ('foo'),('bar'); +SELECT DISTINCT - GREATEST( b, CAST( NULL AS TIME) ) AS f FROM t1; +f +NULL +Warnings: +Warning 1292 Incorrect time value: 'foo' +Warning 1292 Incorrect time value: 'bar' +DROP TABLE t1; +CREATE TABLE t1 (b LONGBLOB); +INSERT IGNORE INTO t1 VALUES ('foo'),('bar'); +SELECT DISTINCT - GREATEST( b, CAST( NULL AS DATE) ) AS f FROM t1; +f +NULL +Warnings: +Warning 1292 Truncated incorrect datetime value: 'foo' +Warning 1292 Truncated incorrect datetime value: 'bar' +DROP TABLE t1; +# # End of 10.1 tests # # diff --git a/mysql-test/main/func_hybrid_type.test b/mysql-test/main/func_hybrid_type.test index 020f4ce93bd..71536339b4b 100644 --- a/mysql-test/main/func_hybrid_type.test +++ b/mysql-test/main/func_hybrid_type.test @@ -458,6 +458,26 @@ EXECUTE stmt USING @a,@a; SHOW CREATE TABLE t1; DROP TABLE t1; + +--echo # +--echo # MDEV-11015 Assertion failed: precision > 0 in decimal_bin_size upon SELECT with DISTINCT, CAST and other functions +--echo # + +CREATE TABLE t1 (b LONGBLOB); +INSERT IGNORE INTO t1 VALUES ('foo'),('bar'); +SELECT DISTINCT - GREATEST( b, CAST( NULL AS DATETIME ) ) AS f FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (b LONGBLOB); +INSERT IGNORE INTO t1 VALUES ('foo'),('bar'); +SELECT DISTINCT - GREATEST( b, CAST( NULL AS TIME) ) AS f FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (b LONGBLOB); +INSERT IGNORE INTO t1 VALUES ('foo'),('bar'); +SELECT DISTINCT - GREATEST( b, CAST( NULL AS DATE) ) AS f FROM t1; +DROP TABLE t1; + --echo # --echo # End of 10.1 tests --echo # diff --git a/mysql-test/main/func_json.result b/mysql-test/main/func_json.result index aa5685b19fa..4fc52e1960f 100644 --- a/mysql-test/main/func_json.result +++ b/mysql-test/main/func_json.result @@ -306,7 +306,7 @@ select json_merge('string', 123); json_merge('string', 123) NULL Warnings: -Warning 4038 Syntax error in JSON text in argument 1 to function 'json_merge' at position 1 +Warning 4038 Syntax error in JSON text in argument 1 to function 'json_merge_preserve' at position 1 select json_merge('"string"', 123); json_merge('"string"', 123) ["string", 123] @@ -326,7 +326,7 @@ select json_merge('a','b'); json_merge('a','b') NULL Warnings: -Warning 4038 Syntax error in JSON text in argument 1 to function 'json_merge' at position 1 +Warning 4038 Syntax error in JSON text in argument 1 to function 'json_merge_preserve' at position 1 select json_merge('{"a":"b"}','{"c":"d"}'); json_merge('{"a":"b"}','{"c":"d"}') {"a": "b", "c": "d"} @@ -843,6 +843,77 @@ SELECT CHARSET(JSON_OBJECT()); CHARSET(JSON_OBJECT()) latin1 # +# MDEV-13992 Implement JSON_MERGE_PATCH +# +CREATE TABLE merge_t( +id INT PRIMARY KEY AUTO_INCREMENT, +target VARCHAR(100), patch VARCHAR(100) +); +INSERT INTO merge_t(target, patch) VALUES +('{"a":"b"}', '{"a":"c"}'), +('{"a":"b"}', '{"b":"c"}'), +('{"a":"b"}', '{"a":null}'), +('{"a":"b", "b":"c"}', '{"a":null}'), +('{"a":["b"]}', '{"a":"c"}'), +('{"a":"c"}', '{"a":["b"]}'), +('{"a": {"b":"c"}}', '{"a": {"b":"d", "c":null}}'), +('{"a":[{"b":"c"}]}', '{"a": [1]}'), +('["a","b"]', '["c","d"]'), +('{"a":"b"}', '["c"]'), +('{"a":"foo"}', 'null'), +('{"a":"foo"}', '"bar"'), +('{"e":null}', '{"a":1}'), +('[1,2]', '{"a":"b", "c":null}'), +('{}', '{"a":{"bb":{"ccc":null}}}'), +(NULL, '{}'), +('{}', NULL); +SELECT id, target, patch, +JSON_MERGE_PATCH(target, patch) AS merged, +JSON_EXTRACT(JSON_MERGE_PATCH(target, patch), '$.a') AS a +FROM merge_t ORDER BY id; +id target patch merged a +1 {"a":"b"} {"a":"c"} {"a": "c"} "c" +2 {"a":"b"} {"b":"c"} {"a": "b", "b": "c"} "b" +3 {"a":"b"} {"a":null} {} NULL +4 {"a":"b", "b":"c"} {"a":null} {"b": "c"} NULL +5 {"a":["b"]} {"a":"c"} {"a": "c"} "c" +6 {"a":"c"} {"a":["b"]} {"a": ["b"]} ["b"] +7 {"a": {"b":"c"}} {"a": {"b":"d", "c":null}} {"a": {"b": "d"}} {"b": "d"} +8 {"a":[{"b":"c"}]} {"a": [1]} {"a": [1]} [1] +9 ["a","b"] ["c","d"] ["c", "d"] NULL +10 {"a":"b"} ["c"] ["c"] NULL +11 {"a":"foo"} null null NULL +12 {"a":"foo"} "bar" "bar" NULL +13 {"e":null} {"a":1} {"e": null, "a": 1} 1 +14 [1,2] {"a":"b", "c":null} {"a": "b"} "b" +15 {} {"a":{"bb":{"ccc":null}}} {"a": {"bb": {}}} {"bb": {}} +16 NULL {} NULL NULL +17 {} NULL NULL NULL +DROP TABLE merge_t; +SELECT JSON_MERGE_PATCH('{"a":"b"}', NULL, '{"c":"d"}'); +JSON_MERGE_PATCH('{"a":"b"}', NULL, '{"c":"d"}') +NULL +SELECT JSON_MERGE_PATCH(NULL, '[1,2,3]'); +JSON_MERGE_PATCH(NULL, '[1,2,3]') +[1, 2, 3] +SELECT JSON_MERGE_PATCH('{"a":"b"}', NULL, '[1,2,3]', '{"c":null,"d":"e"}'); +JSON_MERGE_PATCH('{"a":"b"}', NULL, '[1,2,3]', '{"c":null,"d":"e"}') +{"d": "e"} +SELECT JSON_MERGE_PATCH(); +ERROR 42000: Incorrect parameter count in the call to native function 'JSON_MERGE_PATCH' +SELECT JSON_MERGE_PATCH('{}'); +ERROR 42000: Incorrect parameter count in the call to native function 'JSON_MERGE_PATCH' +SELECT JSON_MERGE_PATCH('{', '[1,2,3]'); +JSON_MERGE_PATCH('{', '[1,2,3]') +NULL +Warnings: +Warning 4037 Unexpected end of JSON text in argument 1 to function 'json_merge_patch' +SELECT JSON_MERGE_PATCH('{"a":"b"}', '[1,'); +JSON_MERGE_PATCH('{"a":"b"}', '[1,') +NULL +Warnings: +Warning 4037 Unexpected end of JSON text in argument 2 to function 'json_merge_patch' +# # End of 10.2 tests # # diff --git a/mysql-test/main/func_json.test b/mysql-test/main/func_json.test index ea0be8fd757..55879e4f910 100644 --- a/mysql-test/main/func_json.test +++ b/mysql-test/main/func_json.test @@ -492,6 +492,49 @@ SELECT CHARSET(JSON_ARRAY()); SELECT CHARSET(JSON_OBJECT()); --echo # +--echo # MDEV-13992 Implement JSON_MERGE_PATCH +--echo # + +CREATE TABLE merge_t( +id INT PRIMARY KEY AUTO_INCREMENT, +target VARCHAR(100), patch VARCHAR(100) +); +INSERT INTO merge_t(target, patch) VALUES +('{"a":"b"}', '{"a":"c"}'), +('{"a":"b"}', '{"b":"c"}'), +('{"a":"b"}', '{"a":null}'), +('{"a":"b", "b":"c"}', '{"a":null}'), +('{"a":["b"]}', '{"a":"c"}'), +('{"a":"c"}', '{"a":["b"]}'), +('{"a": {"b":"c"}}', '{"a": {"b":"d", "c":null}}'), +('{"a":[{"b":"c"}]}', '{"a": [1]}'), +('["a","b"]', '["c","d"]'), +('{"a":"b"}', '["c"]'), +('{"a":"foo"}', 'null'), +('{"a":"foo"}', '"bar"'), +('{"e":null}', '{"a":1}'), +('[1,2]', '{"a":"b", "c":null}'), +('{}', '{"a":{"bb":{"ccc":null}}}'), +(NULL, '{}'), +('{}', NULL); +SELECT id, target, patch, + JSON_MERGE_PATCH(target, patch) AS merged, + JSON_EXTRACT(JSON_MERGE_PATCH(target, patch), '$.a') AS a +FROM merge_t ORDER BY id; +DROP TABLE merge_t; + +SELECT JSON_MERGE_PATCH('{"a":"b"}', NULL, '{"c":"d"}'); +SELECT JSON_MERGE_PATCH(NULL, '[1,2,3]'); +SELECT JSON_MERGE_PATCH('{"a":"b"}', NULL, '[1,2,3]', '{"c":null,"d":"e"}'); + +--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT +SELECT JSON_MERGE_PATCH(); +--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT +SELECT JSON_MERGE_PATCH('{}'); +SELECT JSON_MERGE_PATCH('{', '[1,2,3]'); +SELECT JSON_MERGE_PATCH('{"a":"b"}', '[1,'); + +--echo # --echo # End of 10.2 tests --echo # diff --git a/mysql-test/main/func_str.result b/mysql-test/main/func_str.result index ecc8a4b353b..f916aae7e9d 100644 --- a/mysql-test/main/func_str.result +++ b/mysql-test/main/func_str.result @@ -4972,6 +4972,44 @@ YQ== 61 Yq== 62 DROP TABLE t1; # +# MDEV-18738 ASAN heap-use-after-free in copy_if_not_alloced / copy_fields +# +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2); +SELECT REPLACE( CAST( CURDATE() AS BINARY ), CURDATE(), REPEAT('a',32) ) AS f FROM t1 GROUP BY f; +f +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +DROP TABLE t1; +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2); +SELECT REPLACE( LEFT( CURDATE(), 4), LEFT(CURDATE(),4), REPEAT('a',32) ) AS f FROM t1 GROUP BY f; +f +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +DROP TABLE t1; +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2); +SELECT REPLACE(RIGHT(CURDATE(), 4), RIGHT(CURDATE(),4), REPEAT('a',32)) AS f FROM t1 GROUP BY f; +f +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +DROP TABLE t1; +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2); +SELECT REPLACE(SUBSTR(CURDATE(),2,3), SUBSTR(CURDATE(),2,3), REPEAT('a',32)) AS f FROM t1 GROUP BY f; +f +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +DROP TABLE t1; +# +# MDEV-19359 ASAN heap-use-after-free in copy_if_not_alloced / make_sortkey +# +CREATE TABLE t1 (a INT, b TIME, c TIME); +INSERT INTO t1 VALUES (NULL,'22:56:45','22:56:45'),(4,'12:51:42','12:51:42'); +SELECT REPLACE( BINARY c, a, b ) f FROM t1 GROUP BY f WITH ROLLUP; +f +NULL +12:51:12:51:422 +NULL +DROP TABLE t1; +# # End of 10.1 tests # # diff --git a/mysql-test/main/func_str.test b/mysql-test/main/func_str.test index 51b71cc9bda..1abc36de910 100644 --- a/mysql-test/main/func_str.test +++ b/mysql-test/main/func_str.test @@ -1945,6 +1945,42 @@ SELECT f1,HEX(f2) FROM t1 WHERE f1='YQ==' AND (f2= from_base64( SELECT f1,HEX(f2) FROM t1 WHERE f1='YQ==' AND (f2= from_base64("Yq==") OR f2= from_base64("YQ==")); DROP TABLE t1; + +--echo # +--echo # MDEV-18738 ASAN heap-use-after-free in copy_if_not_alloced / copy_fields +--echo # + +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2); +SELECT REPLACE( CAST( CURDATE() AS BINARY ), CURDATE(), REPEAT('a',32) ) AS f FROM t1 GROUP BY f; +DROP TABLE t1; + +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2); +SELECT REPLACE( LEFT( CURDATE(), 4), LEFT(CURDATE(),4), REPEAT('a',32) ) AS f FROM t1 GROUP BY f; +DROP TABLE t1; + +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2); +SELECT REPLACE(RIGHT(CURDATE(), 4), RIGHT(CURDATE(),4), REPEAT('a',32)) AS f FROM t1 GROUP BY f; +DROP TABLE t1; + +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2); +SELECT REPLACE(SUBSTR(CURDATE(),2,3), SUBSTR(CURDATE(),2,3), REPEAT('a',32)) AS f FROM t1 GROUP BY f; +DROP TABLE t1; + + +--echo # +--echo # MDEV-19359 ASAN heap-use-after-free in copy_if_not_alloced / make_sortkey +--echo # + +CREATE TABLE t1 (a INT, b TIME, c TIME); +INSERT INTO t1 VALUES (NULL,'22:56:45','22:56:45'),(4,'12:51:42','12:51:42'); +SELECT REPLACE( BINARY c, a, b ) f FROM t1 GROUP BY f WITH ROLLUP; +DROP TABLE t1; + + --echo # --echo # End of 10.1 tests --echo # diff --git a/mysql-test/main/gis.result b/mysql-test/main/gis.result index 191955504c2..653a88b330f 100644 --- a/mysql-test/main/gis.result +++ b/mysql-test/main/gis.result @@ -1865,6 +1865,20 @@ t2 CREATE TABLE `t2` ( `w2` int(1) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1,t2; +CREATE TABLE t1 ( +id INT UNSIGNED NOT NULL AUTO_INCREMENT, +point_data POINT NOT NULL, +PRIMARY KEY (id), +KEY idx_point_data(point_data) +) ENGINE=MyISAM; +INSERT t1 (point_data) VALUES +(GeomFromText('Point(37.0248492 23.8512726)')), +(GeomFromText('Point(38.0248492 23.8512726)')); +SELECT id FROM t1 +WHERE ST_Contains(point_data, GeomFromText('Point(38.0248492 23.8512726)')); +id +2 +DROP TABLE t1; # # Start of 10.2 tests # @@ -2234,8 +2248,20 @@ SELECT c FROM t1; c 1 DROP TABLE t1; +create table t1 (p point default "qwer"); +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +create table t1 (p point default 0); +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +create table t1 (p point not null default st_geometryfromtext('point 0)')); +ERROR 42000: Invalid default value for 'p' +create table t1 (p point not null default st_geometryfromtext('point(0 0)')); +insert into t1 values(default); +select st_astext(p) from t1; +st_astext(p) +POINT(0 0) +drop table t1; # -# Start of 10.3 tests +# End of 10.2 tests # # # MDEV-11478 Result data type aggregation for pluggable data types @@ -4012,6 +4038,8 @@ SELECT CAST(POINT(1,1) AS SIGNED) FROM t1; ERROR HY000: Illegal parameter data type geometry for operation 'cast_as_signed' SELECT CAST(POINT(1,1) AS UNSIGNED) FROM t1; ERROR HY000: Illegal parameter data type geometry for operation 'cast_as_unsigned' +SELECT CAST(POINT(1,1) AS FLOAT) FROM t1; +ERROR HY000: Illegal parameter data type geometry for operation 'float_typecast' SELECT CAST(POINT(1,1) AS DOUBLE) FROM t1; ERROR HY000: Illegal parameter data type geometry for operation 'double_typecast' SELECT CAST(POINT(1,1) AS DECIMAL(10,1)) FROM t1; @@ -4028,6 +4056,8 @@ SELECT CAST(a AS SIGNED) FROM t1; ERROR HY000: Illegal parameter data type geometry for operation 'cast_as_signed' SELECT CAST(a AS UNSIGNED) FROM t1; ERROR HY000: Illegal parameter data type geometry for operation 'cast_as_unsigned' +SELECT CAST(a AS FLOAT) FROM t1; +ERROR HY000: Illegal parameter data type geometry for operation 'float_typecast' SELECT CAST(a AS DOUBLE) FROM t1; ERROR HY000: Illegal parameter data type geometry for operation 'double_typecast' SELECT CAST(a AS DECIMAL(10,1)) FROM t1; @@ -4044,6 +4074,8 @@ SELECT CAST(COALESCE(a) AS SIGNED) FROM t1; ERROR HY000: Illegal parameter data type geometry for operation 'cast_as_signed' SELECT CAST(COALESCE(a) AS UNSIGNED) FROM t1; ERROR HY000: Illegal parameter data type geometry for operation 'cast_as_unsigned' +SELECT CAST(COALESCE(a) AS FLOAT) FROM t1; +ERROR HY000: Illegal parameter data type geometry for operation 'float_typecast' SELECT CAST(COALESCE(a) AS DOUBLE) FROM t1; ERROR HY000: Illegal parameter data type geometry for operation 'double_typecast' SELECT CAST(COALESCE(a) AS DECIMAL(10,1)) FROM t1; diff --git a/mysql-test/main/gis.test b/mysql-test/main/gis.test index 3bc77ec50df..1418e4244c8 100644 --- a/mysql-test/main/gis.test +++ b/mysql-test/main/gis.test @@ -1572,6 +1572,25 @@ CREATE TABLE t2 AS SELECT WITHIN(g1,g1) as w1,WITHIN(g2,g2) AS w2 FROM t1; SHOW CREATE TABLE t2; DROP TABLE t1,t2; + +# +# MDEV-3934 Assertion `((keypart_map+1) & keypart_map) == 0' failed in _mi_pack_key with an index on a POINT column +# + +CREATE TABLE t1 ( + id INT UNSIGNED NOT NULL AUTO_INCREMENT, + point_data POINT NOT NULL, + PRIMARY KEY (id), + KEY idx_point_data(point_data) +) ENGINE=MyISAM; +INSERT t1 (point_data) VALUES + (GeomFromText('Point(37.0248492 23.8512726)')), + (GeomFromText('Point(38.0248492 23.8512726)')); +SELECT id FROM t1 +WHERE ST_Contains(point_data, GeomFromText('Point(38.0248492 23.8512726)')); +DROP TABLE t1; + + --echo # --echo # Start of 10.2 tests --echo # @@ -1762,8 +1781,22 @@ INSERT INTO t1 (a,b) VALUES (Point(1,1),Point(1,1)); SELECT c FROM t1; DROP TABLE t1; +# +# MDEV-13923 Assertion `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())' failed upon altering table with geometry field +# +--error ER_CANT_CREATE_GEOMETRY_OBJECT +create table t1 (p point default "qwer"); +--error ER_CANT_CREATE_GEOMETRY_OBJECT +create table t1 (p point default 0); +--error ER_INVALID_DEFAULT +create table t1 (p point not null default st_geometryfromtext('point 0)')); +create table t1 (p point not null default st_geometryfromtext('point(0 0)')); +insert into t1 values(default); +select st_astext(p) from t1; +drop table t1; + --echo # ---echo # Start of 10.3 tests +--echo # End of 10.2 tests --echo # --echo # @@ -2076,6 +2109,8 @@ SELECT CAST(POINT(1,1) AS SIGNED) FROM t1; --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION SELECT CAST(POINT(1,1) AS UNSIGNED) FROM t1; --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT CAST(POINT(1,1) AS FLOAT) FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION SELECT CAST(POINT(1,1) AS DOUBLE) FROM t1; --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION SELECT CAST(POINT(1,1) AS DECIMAL(10,1)) FROM t1; @@ -2093,6 +2128,8 @@ SELECT CAST(a AS SIGNED) FROM t1; --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION SELECT CAST(a AS UNSIGNED) FROM t1; --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT CAST(a AS FLOAT) FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION SELECT CAST(a AS DOUBLE) FROM t1; --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION SELECT CAST(a AS DECIMAL(10,1)) FROM t1; @@ -2110,6 +2147,8 @@ SELECT CAST(COALESCE(a) AS SIGNED) FROM t1; --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION SELECT CAST(COALESCE(a) AS UNSIGNED) FROM t1; --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT CAST(COALESCE(a) AS FLOAT) FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION SELECT CAST(COALESCE(a) AS DOUBLE) FROM t1; --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION SELECT CAST(COALESCE(a) AS DECIMAL(10,1)) FROM t1; diff --git a/mysql-test/main/gis2.result b/mysql-test/main/gis2.result deleted file mode 100644 index 6eb1c54e8d4..00000000000 --- a/mysql-test/main/gis2.result +++ /dev/null @@ -1,38 +0,0 @@ -CREATE TABLE t1 ( -id INT UNSIGNED NOT NULL AUTO_INCREMENT, -point_data POINT NOT NULL, -PRIMARY KEY (id), -KEY idx_point_data(point_data) -) ENGINE=MyISAM; -INSERT t1 (point_data) VALUES -(GeomFromText('Point(37.0248492 23.8512726)')), -(GeomFromText('Point(38.0248492 23.8512726)')); -SELECT id FROM t1 -WHERE ST_Contains(point_data, GeomFromText('Point(38.0248492 23.8512726)')); -id -2 -DROP TABLE t1; -create table t1 (p point default "qwer"); -ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field -create table t1 (p point default 0); -ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field -create table t1 (p point not null default st_geometryfromtext('point 0)')); -ERROR 42000: Invalid default value for 'p' -create table t1 (p point not null default st_geometryfromtext('point(0 0)')); -insert into t1 values(default); -select st_astext(p) from t1; -st_astext(p) -POINT(0 0) -drop table t1; -create table t1 (p point not null default if(unix_timestamp()>10,POINT(1,1),LineString(Point(0,0),Point(1,1)))); -set timestamp=10; -insert into t1 values(default); -ERROR 22007: Incorrect POINT value: 'GEOMETRYCOLLECTION' for column `test`.`t1`.`p` at row 1 -drop table t1; -SET timestamp=default; -create table t1 (p point not null default if(unix_timestamp()>10,POINT(1,1),LineString(Point(0,0),Point(1,1)))); -set timestamp=10; -alter table t1 add column i int; -ERROR 22007: Incorrect POINT value: 'GEOMETRYCOLLECTION' for column `test`.`t1`.`p` at row 1 -drop table t1; -SET timestamp=default; diff --git a/mysql-test/main/gis2.test b/mysql-test/main/gis2.test deleted file mode 100644 index 9731e2a91d0..00000000000 --- a/mysql-test/main/gis2.test +++ /dev/null @@ -1,45 +0,0 @@ -# -# MDEV-3934 Assertion `((keypart_map+1) & keypart_map) == 0' failed in _mi_pack_key with an index on a POINT column -# - -CREATE TABLE t1 ( - id INT UNSIGNED NOT NULL AUTO_INCREMENT, - point_data POINT NOT NULL, - PRIMARY KEY (id), - KEY idx_point_data(point_data) -) ENGINE=MyISAM; -INSERT t1 (point_data) VALUES - (GeomFromText('Point(37.0248492 23.8512726)')), - (GeomFromText('Point(38.0248492 23.8512726)')); -SELECT id FROM t1 -WHERE ST_Contains(point_data, GeomFromText('Point(38.0248492 23.8512726)')); -DROP TABLE t1; - -# -# MDEV-13923 Assertion `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())' failed upon altering table with geometry field -# ---error ER_CANT_CREATE_GEOMETRY_OBJECT -create table t1 (p point default "qwer"); ---error ER_CANT_CREATE_GEOMETRY_OBJECT -create table t1 (p point default 0); ---error ER_INVALID_DEFAULT -create table t1 (p point not null default st_geometryfromtext('point 0)')); -create table t1 (p point not null default st_geometryfromtext('point(0 0)')); -insert into t1 values(default); -select st_astext(p) from t1; -drop table t1; - -create table t1 (p point not null default if(unix_timestamp()>10,POINT(1,1),LineString(Point(0,0),Point(1,1)))); -set timestamp=10; ---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD -insert into t1 values(default); -drop table t1; -SET timestamp=default; - -create table t1 (p point not null default if(unix_timestamp()>10,POINT(1,1),LineString(Point(0,0),Point(1,1)))); -set timestamp=10; ---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD -alter table t1 add column i int; -drop table t1; -SET timestamp=default; - diff --git a/mysql-test/main/gis_notembedded.result b/mysql-test/main/gis_notembedded.result new file mode 100644 index 00000000000..64e90572bf0 --- /dev/null +++ b/mysql-test/main/gis_notembedded.result @@ -0,0 +1,45 @@ +show create procedure mysql.AddGeometryColumn; +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation +AddGeometryColumn CREATE DEFINER=`root`@`localhost` PROCEDURE `AddGeometryColumn`(catalog varchar(64), t_schema varchar(64), + t_name varchar(64), geometry_column varchar(64), t_srid int) + SQL SECURITY INVOKER +begin + set @qwe= concat('ALTER TABLE ', t_schema, '.', t_name, ' ADD ', geometry_column,' GEOMETRY REF_SYSTEM_ID=', t_srid); PREPARE ls from @qwe; execute ls; deallocate prepare ls; end latin1 latin1_swedish_ci latin1_swedish_ci +show create procedure mysql.DropGeometryColumn; +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation +DropGeometryColumn CREATE DEFINER=`root`@`localhost` PROCEDURE `DropGeometryColumn`(catalog varchar(64), t_schema varchar(64), + t_name varchar(64), geometry_column varchar(64)) + SQL SECURITY INVOKER +begin + set @qwe= concat('ALTER TABLE ', t_schema, '.', t_name, ' DROP ', geometry_column); PREPARE ls from @qwe; execute ls; deallocate prepare ls; end latin1 latin1_swedish_ci latin1_swedish_ci +create table t1 (a int, b int); +call mysql.AddGeometryColumn('', 'test', 't1', 'c', 10); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` geometry DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +call mysql.DropGeometryColumn('', 'test', 't1', 'c'); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +call mysql.DropGeometryColumn('', 'test', 't1', 'b'); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create user foo@localhost; +grant execute on mysql.* to foo@localhost; +connect foo, localhost, foo; +call mysql.AddGeometryColumn('', 'mysql', 'proc', 'c', 10); +ERROR 42000: ALTER command denied to user 'foo'@'localhost' for table 'proc' +disconnect foo; +connection default; +drop user foo@localhost; diff --git a/mysql-test/main/gis_notembedded.test b/mysql-test/main/gis_notembedded.test new file mode 100644 index 00000000000..d25d6a7097e --- /dev/null +++ b/mysql-test/main/gis_notembedded.test @@ -0,0 +1,24 @@ +source include/not_embedded.inc; +# +# MDEV-60 Support for Spatial Reference systems for the GIS data. +# +show create procedure mysql.AddGeometryColumn; +show create procedure mysql.DropGeometryColumn; +create table t1 (a int, b int); +call mysql.AddGeometryColumn('', 'test', 't1', 'c', 10); +show create table t1; +call mysql.DropGeometryColumn('', 'test', 't1', 'c'); +show create table t1; +call mysql.DropGeometryColumn('', 'test', 't1', 'b'); +show create table t1; +drop table t1; + +create user foo@localhost; +grant execute on mysql.* to foo@localhost; +connect (foo, localhost, foo); +--error ER_TABLEACCESS_DENIED_ERROR +call mysql.AddGeometryColumn('', 'mysql', 'proc', 'c', 10); +disconnect foo; +connection default; +drop user foo@localhost; + diff --git a/mysql-test/main/grant4.result b/mysql-test/main/grant4.result index 9aad70205ec..9da0b0b40b7 100644 --- a/mysql-test/main/grant4.result +++ b/mysql-test/main/grant4.result @@ -129,6 +129,26 @@ connection default; disconnect con1; drop database mysqltest_db1; drop user mysqltest_u1@localhost; +call mtr.add_suppression("Table 'mysql.user' doesn't exist"); +call mtr.add_suppression("'mysql.user' is not of type 'TABLE'"); +rename table mysql.user to mysql.user1; +create view mysql.user as select * from mysql.user1; +flush privileges; +ERROR HY000: 'mysql.user' is not of type 'TABLE' +drop view mysql.user; +create temporary table mysql.user select * from mysql.user1 limit 0; +flush privileges; +ERROR 42S02: Table 'mysql.user' doesn't exist +drop temporary table mysql.user; +rename table mysql.user1 to mysql.user; +call mtr.add_suppression('mysql.user table is damaged'); +rename table mysql.user to mysql.user1; +create table mysql.user (Host char(100), User char(100)); +flush privileges; +ERROR HY000: Unknown error +drop table mysql.user; +rename table mysql.user1 to mysql.user; +End of 5.5 tests # # Additional coverage for refactoring which is made as part # of fix for bug #27480 "Extend CREATE TEMPORARY TABLES privilege @@ -224,3 +244,4 @@ ERROR HY000: Password hash should be a 16-digit hexadecimal number create user foo4 identified via mysql_old_password using '11111111111111111111111111111111111111111'; ERROR HY000: Password hash should be a 16-digit hexadecimal number set GLOBAL sql_mode=default; +End of 10.1 tests diff --git a/mysql-test/main/grant4.test b/mysql-test/main/grant4.test index 2715b7c7145..a63bd158a0d 100644 --- a/mysql-test/main/grant4.test +++ b/mysql-test/main/grant4.test @@ -145,6 +145,38 @@ disconnect con1; drop database mysqltest_db1; drop user mysqltest_u1@localhost; +# +# MDEV-18241 Downgrade from 10.4 to 10.3 crashes +# +source include/switch_to_mysql_user.inc; +call mtr.add_suppression("Table 'mysql.user' doesn't exist"); +call mtr.add_suppression("'mysql.user' is not of type 'TABLE'"); +rename table mysql.user to mysql.user1; +create view mysql.user as select * from mysql.user1; +--error ER_WRONG_OBJECT +flush privileges; +drop view mysql.user; +create temporary table mysql.user select * from mysql.user1 limit 0; +--error ER_NO_SUCH_TABLE +flush privileges; +drop temporary table mysql.user; +rename table mysql.user1 to mysql.user; +source include/switch_to_mysql_global_priv.inc; + +# +# Bug#28986737: RENAMING AND REPLACING MYSQL.USER TABLE CAN LEAD TO A SERVER CRASH +# +source include/switch_to_mysql_user.inc; +call mtr.add_suppression('mysql.user table is damaged'); +rename table mysql.user to mysql.user1; +create table mysql.user (Host char(100), User char(100)); +--error ER_UNKNOWN_ERROR +flush privileges; +drop table mysql.user; +rename table mysql.user1 to mysql.user; +source include/switch_to_mysql_global_priv.inc; + +--echo End of 5.5 tests --echo # --echo # Additional coverage for refactoring which is made as part @@ -233,5 +265,6 @@ create user foo3 identified via mysql_old_password using '00'; --error ER_PASSWD_LENGTH create user foo4 identified via mysql_old_password using '11111111111111111111111111111111111111111'; - set GLOBAL sql_mode=default; + +--echo End of 10.1 tests diff --git a/mysql-test/main/information_schema_prepare.result b/mysql-test/main/information_schema_prepare.result new file mode 100644 index 00000000000..3b5ee16b14b --- /dev/null +++ b/mysql-test/main/information_schema_prepare.result @@ -0,0 +1,4 @@ +PREPARE stmt2 FROM "CREATE VIEW v AS SELECT * FROM INFORMATION_SCHEMA.TABLES"; +FLUSH PRIVILEGES; +EXECUTE stmt2; +DROP VIEW v; diff --git a/mysql-test/main/information_schema_prepare.test b/mysql-test/main/information_schema_prepare.test new file mode 100644 index 00000000000..c5f3f89ff29 --- /dev/null +++ b/mysql-test/main/information_schema_prepare.test @@ -0,0 +1,7 @@ +# +# MDEV-15907 ASAN heap-use-after-free in strnmov / .. / fill_effective_table_privileges on concurrent GRANT and CREATE VIEW +# +PREPARE stmt2 FROM "CREATE VIEW v AS SELECT * FROM INFORMATION_SCHEMA.TABLES"; +FLUSH PRIVILEGES; +EXECUTE stmt2; +DROP VIEW v; diff --git a/mysql-test/main/lock_sync.result b/mysql-test/main/lock_sync.result index bbdc1d43ba5..70960503fef 100644 --- a/mysql-test/main/lock_sync.result +++ b/mysql-test/main/lock_sync.result @@ -745,7 +745,11 @@ disconnect con2; # Bug#51391 Deadlock involving events during rqg_info_schema test # CREATE EVENT e1 ON SCHEDULE EVERY 5 HOUR DO SELECT 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. CREATE EVENT e2 ON SCHEDULE EVERY 5 HOUR DO SELECT 2; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. connect con1, localhost, root; SET DEBUG_SYNC="before_lock_tables_takes_lock SIGNAL drop WAIT_FOR query"; # Sending: diff --git a/mysql-test/main/mdev_19276.result b/mysql-test/main/mdev_19276.result new file mode 100644 index 00000000000..c1b822de6bf --- /dev/null +++ b/mysql-test/main/mdev_19276.result @@ -0,0 +1,11 @@ +CREATE DATABASE db1; +CREATE USER u@localhost IDENTIFIED BY 'pw'; +set global log_warnings=2; +connect(localhost,u,pw,db1,MASTER_PORT,MASTER_SOCKET); +connect con1,localhost,u,pw,db1; +ERROR 42000: Access denied for user 'u'@'localhost' to database 'db1' +connection default; +FOUND 1 /Access denied for user 'u'@'localhost' to database 'db1'/ in mysqld.1.err +set global log_warnings=@@log_warnings; +DROP DATABASE db1; +DROP USER u@localhost; diff --git a/mysql-test/main/mdev_19276.test b/mysql-test/main/mdev_19276.test new file mode 100644 index 00000000000..3e6b72a3f55 --- /dev/null +++ b/mysql-test/main/mdev_19276.test @@ -0,0 +1,17 @@ +source include/not_embedded.inc; + +CREATE DATABASE db1; +CREATE USER u@localhost IDENTIFIED BY 'pw'; +set global log_warnings=2; + +--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT +--error ER_DBACCESS_DENIED_ERROR +--connect(con1,localhost,u,pw,db1) +--connection default +let SEARCH_FILE=$MYSQLTEST_VARDIR/log/mysqld.1.err; +let SEARCH_RANGE= -50; +let SEARCH_PATTERN=Access denied for user 'u'@'localhost' to database 'db1'; +source include/search_pattern_in_file.inc; +set global log_warnings=@@log_warnings; +DROP DATABASE db1; +DROP USER u@localhost; diff --git a/mysql-test/main/multi_update.result b/mysql-test/main/multi_update.result index d2a33619900..4a16a7af3f6 100644 --- a/mysql-test/main/multi_update.result +++ b/mysql-test/main/multi_update.result @@ -940,6 +940,29 @@ execute stmt1; deallocate prepare stmt1; drop view v3,v2,v1; drop table t1,t2,t3; +create table t1 (id int not null, v1 varchar(10) not null); +insert into t1 values (1,1),(2,2); +create table t2 (log varchar(10) not null); +create trigger t1_after_update after update on t1 +for each row insert into t2 values ('triggered'); +create user foo; +grant select, insert, update, delete, create, drop, reload, index, alter, show databases, create temporary tables, lock tables, execute, create view, show view, create routine, alter routine, trigger on *.* to 'foo'@'%'; +set global read_only=1; +connect a, localhost, foo; +create temporary table temp_t1 (id int not null, update_me varchar(10)); +insert into temp_t1 values (1,1),(2,2),(3,3); +update temp_t1 left join t1 on temp_t1.id = t1.id set temp_t1.update_me = 'hello'; +connection default; +set global read_only = 0; +create table t3 (id int not null); +insert t3 values (2); +update t1 left join t3 on t1.id = t3.id set t1.v1 = 'hello'; +select * from t2; +log +triggered +triggered +drop table t1,t2, t3; +drop user foo; end of 5.5 tests create table t1 (c1 int, c3 int); insert t1(c3) values (1), (2), (3), (4), (5), (6), (7), (8); diff --git a/mysql-test/main/multi_update.test b/mysql-test/main/multi_update.test index 42e34d1e4a1..b6ad8bfcf52 100644 --- a/mysql-test/main/multi_update.test +++ b/mysql-test/main/multi_update.test @@ -899,6 +899,37 @@ deallocate prepare stmt1; drop view v3,v2,v1; drop table t1,t2,t3; + +# +# MDEV-18507 can't update temporary table when joined with table with triggers on read-only +# +create table t1 (id int not null, v1 varchar(10) not null); +insert into t1 values (1,1),(2,2); +create table t2 (log varchar(10) not null); +create trigger t1_after_update after update on t1 + for each row insert into t2 values ('triggered'); + +create user foo; +grant select, insert, update, delete, create, drop, reload, index, alter, show databases, create temporary tables, lock tables, execute, create view, show view, create routine, alter routine, trigger on *.* to 'foo'@'%'; + +set global read_only=1; +connect a, localhost, foo; + +create temporary table temp_t1 (id int not null, update_me varchar(10)); +insert into temp_t1 values (1,1),(2,2),(3,3); +update temp_t1 left join t1 on temp_t1.id = t1.id set temp_t1.update_me = 'hello'; + +connection default; +set global read_only = 0; + +create table t3 (id int not null); +insert t3 values (2); +update t1 left join t3 on t1.id = t3.id set t1.v1 = 'hello'; +select * from t2; + +drop table t1,t2, t3; +drop user foo; + --echo end of 5.5 tests # diff --git a/mysql-test/main/multi_update2-master.opt b/mysql-test/main/multi_update_big.opt index da78f987af3..da78f987af3 100644 --- a/mysql-test/main/multi_update2-master.opt +++ b/mysql-test/main/multi_update_big.opt diff --git a/mysql-test/main/multi_update2.result b/mysql-test/main/multi_update_big.result index 3712e638f40..3712e638f40 100644 --- a/mysql-test/main/multi_update2.result +++ b/mysql-test/main/multi_update_big.result diff --git a/mysql-test/main/multi_update2.test b/mysql-test/main/multi_update_big.test index a0f17fabec4..a0f17fabec4 100644 --- a/mysql-test/main/multi_update2.test +++ b/mysql-test/main/multi_update_big.test diff --git a/mysql-test/main/mysqldump-compat.result b/mysql-test/main/mysqldump-compat.result index f15cc7a1d7a..9a24ef2a3d1 100644 --- a/mysql-test/main/mysqldump-compat.result +++ b/mysql-test/main/mysqldump-compat.result @@ -2,3 +2,7 @@ CREATE DATABASE mysqldump_30126; USE mysqldump_30126; CREATE TABLE t1 (c1 int); DROP DATABASE mysqldump_30126; +use test; +create table t1 (a int); +create trigger tr after insert on t1 for each row set @a=1; +drop table t1; diff --git a/mysql-test/main/mysqldump-compat.test b/mysql-test/main/mysqldump-compat.test index 9a830b16f26..ae74a760953 100644 --- a/mysql-test/main/mysqldump-compat.test +++ b/mysql-test/main/mysqldump-compat.test @@ -15,3 +15,16 @@ CREATE TABLE t1 (c1 int); DROP DATABASE mysqldump_30126; --remove_file $file +use test; + +# +# MDEV-19182 mysqldump not always handling SHOW CREATE TRIGGER failures correctly +# +create table t1 (a int); +create trigger tr after insert on t1 for each row set @a=1; +let $datadir=`select @@datadir`; +move_file $datadir/test/tr.TRN $datadir/test/tr-1.TRN; +error 2; +exec $MYSQL_DUMP test t1 >/dev/null; +move_file $datadir/test/tr-1.TRN $datadir/test/tr.TRN; +drop table t1; diff --git a/mysql-test/main/mysqldump.result b/mysql-test/main/mysqldump.result index 41a719c6a94..790a519e251 100644 --- a/mysql-test/main/mysqldump.result +++ b/mysql-test/main/mysqldump.result @@ -4320,6 +4320,8 @@ create database first; use first; set time_zone = 'UTC'; create event ee1 on schedule at '2035-12-31 20:01:23' do set @a=5; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. show events; Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation first ee1 root@localhost UTC ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci @@ -4336,7 +4338,11 @@ show create event ee1; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation ee1 UTC CREATE DEFINER=`root`@`localhost` EVENT `ee1` ON SCHEDULE AT '2035-12-31 20:01:23' ON COMPLETION NOT PRESERVE ENABLE DO set @a=5 latin1 latin1_swedish_ci latin1_swedish_ci create event ee2 on schedule at '2030-12-31 21:01:22' do set @a=5; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. create event ee3 on schedule at '2030-12-31 22:01:23' do set @a=5; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. show events; Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation second ee1 root@localhost UTC ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci @@ -4473,6 +4479,8 @@ DROP DATABASE mysqldump_test_db; TRUNCATE mysql.event; USE test; CREATE event e29938 ON SCHEDULE AT '2035-12-31 20:01:23' DO SET @bug29938=29938; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW EVENTS; Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation test e29938 root@localhost SYSTEM ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci @@ -4567,6 +4575,8 @@ CREATE TABLE t1 (f1 INT); CREATE TRIGGER tr1 BEFORE UPDATE ON t1 FOR EACH ROW SET @f1 = 1; CREATE PROCEDURE pr1 () SELECT "Meow"; CREATE EVENT ev1 ON SCHEDULE AT '2030-01-01 00:00:00' DO SELECT "Meow"; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW TRIGGERS; Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation @@ -4757,7 +4767,11 @@ SELECT COUNT(*) INTO param1 FROM t2; END// # Events. CREATE EVENT e1 ON SCHEDULE EVERY 1 SECOND DO DROP DATABASE BUG52792; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. CREATE EVENT e2 ON SCHEDULE EVERY 1 SECOND DO DROP DATABASE BUG52792; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. # Functions. CREATE FUNCTION `hello1` (s CHAR(20)) RETURNS CHAR(50) DETERMINISTIC @@ -5362,6 +5376,8 @@ one` BEFORE INSERT ON `tab one` FOR EACH ROW SET NEW.a = 1; CREATE EVENT `event one` ON SCHEDULE AT '2030-01-01 00:00:00' DO SET @a=5; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW TABLES FROM bug25717383; Tables_in_bug25717383 tab @@ -5625,6 +5641,24 @@ DROP FUNCTION f; DROP VIEW v1; DROP FUNCTION f; # +# MDEV-788 New option to ignore foreign key contraints in mysqlimport +# +create table t1 ( +id int primary key +) engine=InnoDB; +create table t2 ( +t1_id int, +CONSTRAINT fk +FOREIGN KEY (t1_id) REFERENCES t1 (id) +) ENGINE = InnoDB; +select count(*) from t2; +count(*) +1 +select count(*) from t2; +count(*) +2 +drop tables t2, t1; +# # Test for --add-drop-trigger # use test; diff --git a/mysql-test/main/mysqldump.test b/mysql-test/main/mysqldump.test index e2d9cc74d32..97724a621e3 100644 --- a/mysql-test/main/mysqldump.test +++ b/mysql-test/main/mysqldump.test @@ -2500,6 +2500,7 @@ DROP TABLE t1; DROP TABLE t2; DROP DATABASE db_20772273; USE test; +--remove_file $MYSQLTEST_VARDIR/tmp/t2.txt --echo # --echo # Bug #25717383: MYSQLDUMP MAY EXECUTE ANY ARBITRARY QUERY @@ -2669,6 +2670,34 @@ DROP VIEW v1; DROP FUNCTION f; --echo # +--echo # MDEV-788 New option to ignore foreign key contraints in mysqlimport +--echo # +create table t1 ( + id int primary key +) engine=InnoDB; + +create table t2 ( + t1_id int, + CONSTRAINT fk + FOREIGN KEY (t1_id) REFERENCES t1 (id) +) ENGINE = InnoDB; + +--write_file $MYSQLTEST_VARDIR/tmp/t2.txt +0 +EOF + +--error 1 +--exec $MYSQL_IMPORT --silent test $MYSQLTEST_VARDIR/tmp/t2.txt +--exec $MYSQL_IMPORT --silent -k test $MYSQLTEST_VARDIR/tmp/t2.txt +select count(*) from t2; + +--exec $MYSQL_IMPORT --silent --ignore-foreign-keys test $MYSQLTEST_VARDIR/tmp/t2.txt +select count(*) from t2; + +--remove_file $MYSQLTEST_VARDIR/tmp/t2.txt +drop tables t2, t1; + +--echo # --echo # Test for --add-drop-trigger --echo # use test; diff --git a/mysql-test/main/partition_innodb.result b/mysql-test/main/partition_innodb.result index 605ac38384e..c0f36a284fd 100644 --- a/mysql-test/main/partition_innodb.result +++ b/mysql-test/main/partition_innodb.result @@ -966,6 +966,48 @@ DROP view v; DROP TABLE t; set sql_mode= @save_sql_mode; # +# Bug#28573894 ALTER PARTITIONED TABLE ADD AUTO_INCREMENT DIFF RESULT +# +CREATE TABLE t (a VARCHAR(10) NOT NULL,b INT,PRIMARY KEY (b)) ENGINE=INNODB +PARTITION BY RANGE (b) +(PARTITION pa VALUES LESS THAN (2), +PARTITION pb VALUES LESS THAN (20), +PARTITION pc VALUES LESS THAN (30), +PARTITION pd VALUES LESS THAN (40)); +INSERT INTO t +VALUES('A',0),('B',1),('C',2),('D',3),('E',4),('F',5),('G',25),('H',35); +CREATE TABLE t_copy LIKE t; +INSERT INTO t_copy SELECT * FROM t; +ALTER TABLE t ADD COLUMN r INT UNSIGNED NOT NULL AUTO_INCREMENT, +ADD UNIQUE KEY (r,b); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +ALTER TABLE t_copy ADD COLUMN r INT UNSIGNED NOT NULL AUTO_INCREMENT, +ADD UNIQUE KEY (r,b), ALGORITHM=COPY; +affected rows: 8 +info: Records: 8 Duplicates: 0 Warnings: 0 +SELECT * FROM t; +a b r +A 0 1 +B 1 2 +C 2 3 +D 3 4 +E 4 5 +F 5 6 +G 25 7 +H 35 8 +SELECT * FROM t_copy; +a b r +A 0 1 +B 1 2 +C 2 3 +D 3 4 +E 4 5 +F 5 6 +G 25 7 +H 35 8 +DROP TABLE t,t_copy; +# # Bug#26390658 RENAMING A PARTITIONED TABLE DOES NOT UPDATE # MYSQL.INNODB_TABLE_STATS # diff --git a/mysql-test/main/partition_innodb.test b/mysql-test/main/partition_innodb.test index ae0ce59fabc..f663c6381d3 100644 --- a/mysql-test/main/partition_innodb.test +++ b/mysql-test/main/partition_innodb.test @@ -1052,6 +1052,31 @@ DROP TABLE t; set sql_mode= @save_sql_mode; --echo # +--echo # Bug#28573894 ALTER PARTITIONED TABLE ADD AUTO_INCREMENT DIFF RESULT +--echo # +CREATE TABLE t (a VARCHAR(10) NOT NULL,b INT,PRIMARY KEY (b)) ENGINE=INNODB +PARTITION BY RANGE (b) +(PARTITION pa VALUES LESS THAN (2), + PARTITION pb VALUES LESS THAN (20), + PARTITION pc VALUES LESS THAN (30), + PARTITION pd VALUES LESS THAN (40)); + +INSERT INTO t +VALUES('A',0),('B',1),('C',2),('D',3),('E',4),('F',5),('G',25),('H',35); +CREATE TABLE t_copy LIKE t; +INSERT INTO t_copy SELECT * FROM t; + +--enable_info +ALTER TABLE t ADD COLUMN r INT UNSIGNED NOT NULL AUTO_INCREMENT, +ADD UNIQUE KEY (r,b); +ALTER TABLE t_copy ADD COLUMN r INT UNSIGNED NOT NULL AUTO_INCREMENT, +ADD UNIQUE KEY (r,b), ALGORITHM=COPY; +--disable_info +SELECT * FROM t; +SELECT * FROM t_copy; +DROP TABLE t,t_copy; + +--echo # --echo # Bug#26390658 RENAMING A PARTITIONED TABLE DOES NOT UPDATE --echo # MYSQL.INNODB_TABLE_STATS --echo # diff --git a/mysql-test/main/ps.result b/mysql-test/main/ps.result index c9f89b94e41..1e846180429 100644 --- a/mysql-test/main/ps.result +++ b/mysql-test/main/ps.result @@ -2735,9 +2735,13 @@ create procedure proc_1() alter event xyz comment 'xyz'; call proc_1(); drop event xyz; create event xyz on schedule every 5 minute disable do select 123; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. call proc_1(); drop event xyz; create event xyz on schedule every 5 minute disable do select 123; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. call proc_1(); drop event xyz; drop procedure proc_1; @@ -2752,6 +2756,8 @@ create event xyz on schedule every 5 minute disable do select 123; create procedure proc_1() drop event xyz; call proc_1(); create event xyz on schedule every 5 minute disable do select 123; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. call proc_1(); call proc_1(); ERROR HY000: Unknown event 'xyz' @@ -4428,6 +4434,23 @@ END; 1 1 # +# MDEV-14572: Assertion `! is_set()' failed in +# Diagnostics_area::set_eof_status upon EXPLAIN UPDATE in PS +# +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (b INT); +PREPARE stmt FROM 'EXPLAIN UPDATE t1, t2 SET a = 1'; +EXECUTE stmt; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found +1 SIMPLE t2 system NULL NULL NULL NULL 0 Const row not found +EXECUTE stmt; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found +1 SIMPLE t2 system NULL NULL NULL NULL 0 Const row not found +deallocate prepare stmt; +DROP TABLE t1, t2; +# # End of 10.1 tests # # diff --git a/mysql-test/main/ps.test b/mysql-test/main/ps.test index 4254c7c41eb..f701716e4f4 100644 --- a/mysql-test/main/ps.test +++ b/mysql-test/main/ps.test @@ -3916,6 +3916,22 @@ END; / DELIMITER ;/ +--echo # +--echo # MDEV-14572: Assertion `! is_set()' failed in +--echo # Diagnostics_area::set_eof_status upon EXPLAIN UPDATE in PS +--echo # + +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (b INT); + +#EXPLAIN UPDATE t1, t2 SET a = 1; +PREPARE stmt FROM 'EXPLAIN UPDATE t1, t2 SET a = 1'; +EXECUTE stmt; +EXECUTE stmt; +deallocate prepare stmt; + +# Cleanup +DROP TABLE t1, t2; --echo # --echo # End of 10.1 tests diff --git a/mysql-test/main/select.result b/mysql-test/main/select.result index 804830c48df..f4fd91233b5 100644 --- a/mysql-test/main/select.result +++ b/mysql-test/main/select.result @@ -2789,26 +2789,26 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index key1 key1 5 NULL 4 Using where; Using index select max(key1) from t1 where key1 <= 0.6158; max(key1) -0.6158000230789185 +0.6158 select max(key2) from t2 where key2 <= 1.6158; max(key2) -1.6158000230789185 +1.6158 select min(key1) from t1 where key1 >= 0.3762; min(key1) -0.37619999051094055 +0.3762 select min(key2) from t2 where key2 >= 1.3762; min(key2) -1.3761999607086182 +1.3762 select max(key1), min(key2) from t1, t2 where key1 <= 0.6158 and key2 >= 1.3762; max(key1) min(key2) -0.6158000230789185 1.3761999607086182 +0.6158 1.3762 select max(key1) from t1 where key1 <= 0.6158 and rand() + 0.5 >= 0.5; max(key1) -0.38449999690055847 +0.3845 select min(key1) from t1 where key1 >= 0.3762 and rand() + 0.5 >= 0.5; min(key1) -0.38449999690055847 +0.3845 DROP TABLE t1,t2; CREATE TABLE t1 (i BIGINT UNSIGNED NOT NULL); INSERT INTO t1 VALUES (10); diff --git a/mysql-test/main/select_jcl6.result b/mysql-test/main/select_jcl6.result index 31856279ed5..a3544f6be21 100644 --- a/mysql-test/main/select_jcl6.result +++ b/mysql-test/main/select_jcl6.result @@ -2800,26 +2800,26 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index key1 key1 5 NULL 4 Using where; Using index select max(key1) from t1 where key1 <= 0.6158; max(key1) -0.6158000230789185 +0.6158 select max(key2) from t2 where key2 <= 1.6158; max(key2) -1.6158000230789185 +1.6158 select min(key1) from t1 where key1 >= 0.3762; min(key1) -0.37619999051094055 +0.3762 select min(key2) from t2 where key2 >= 1.3762; min(key2) -1.3761999607086182 +1.3762 select max(key1), min(key2) from t1, t2 where key1 <= 0.6158 and key2 >= 1.3762; max(key1) min(key2) -0.6158000230789185 1.3761999607086182 +0.6158 1.3762 select max(key1) from t1 where key1 <= 0.6158 and rand() + 0.5 >= 0.5; max(key1) -0.38449999690055847 +0.3845 select min(key1) from t1 where key1 >= 0.3762 and rand() + 0.5 >= 0.5; min(key1) -0.38449999690055847 +0.3845 DROP TABLE t1,t2; CREATE TABLE t1 (i BIGINT UNSIGNED NOT NULL); INSERT INTO t1 VALUES (10); diff --git a/mysql-test/main/select_pkeycache.result b/mysql-test/main/select_pkeycache.result index 804830c48df..f4fd91233b5 100644 --- a/mysql-test/main/select_pkeycache.result +++ b/mysql-test/main/select_pkeycache.result @@ -2789,26 +2789,26 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index key1 key1 5 NULL 4 Using where; Using index select max(key1) from t1 where key1 <= 0.6158; max(key1) -0.6158000230789185 +0.6158 select max(key2) from t2 where key2 <= 1.6158; max(key2) -1.6158000230789185 +1.6158 select min(key1) from t1 where key1 >= 0.3762; min(key1) -0.37619999051094055 +0.3762 select min(key2) from t2 where key2 >= 1.3762; min(key2) -1.3761999607086182 +1.3762 select max(key1), min(key2) from t1, t2 where key1 <= 0.6158 and key2 >= 1.3762; max(key1) min(key2) -0.6158000230789185 1.3761999607086182 +0.6158 1.3762 select max(key1) from t1 where key1 <= 0.6158 and rand() + 0.5 >= 0.5; max(key1) -0.38449999690055847 +0.3845 select min(key1) from t1 where key1 >= 0.3762 and rand() + 0.5 >= 0.5; min(key1) -0.38449999690055847 +0.3845 DROP TABLE t1,t2; CREATE TABLE t1 (i BIGINT UNSIGNED NOT NULL); INSERT INTO t1 VALUES (10); diff --git a/mysql-test/main/show_check.result b/mysql-test/main/show_check.result index 9205eee1cf7..2cc275d9c26 100644 --- a/mysql-test/main/show_check.result +++ b/mysql-test/main/show_check.result @@ -813,6 +813,8 @@ create event e1 on schedule every 1 year starts now() ends date_add(now(), interval 5 hour) do begin end; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. flush status; show databases; show tables; @@ -1435,6 +1437,8 @@ CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET NEW.c1 = 'ÔÅÓÔ'; CREATE EVENT ev1 ON SCHEDULE AT '1970-01-02 00:00:00' ON COMPLETION PRESERVE DISABLE DO SELECT 'ÔÅÓÔ' AS test; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. set names utf8; SHOW CREATE VIEW v1; View Create View character_set_client collation_connection diff --git a/mysql-test/main/sp_notembedded.result b/mysql-test/main/sp_notembedded.result index 23461867500..518dfc6bfdb 100644 --- a/mysql-test/main/sp_notembedded.result +++ b/mysql-test/main/sp_notembedded.result @@ -304,6 +304,8 @@ USE test; SET @@SQL_MODE = ''; CREATE EVENT teste_bug11763507 ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO SELECT 1 $ +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW EVENTS LIKE 'teste_bug11763507'; Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation test teste_bug11763507 root@localhost SYSTEM ONE TIME # # # # NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci diff --git a/mysql-test/main/ssl_verify_ip.opt b/mysql-test/main/ssl_verify_ip.opt new file mode 100644 index 00000000000..7b1c308e46b --- /dev/null +++ b/mysql-test/main/ssl_verify_ip.opt @@ -0,0 +1,3 @@ +--loose-enable-ssl +--loose-ssl-cert=$MYSQL_TEST_DIR/std_data/serversan-cert.pem +--loose-ssl-key=$MYSQL_TEST_DIR/std_data/serversan-key.pem diff --git a/mysql-test/main/ssl_verify_ip.result b/mysql-test/main/ssl_verify_ip.result new file mode 100644 index 00000000000..98fb6a68656 --- /dev/null +++ b/mysql-test/main/ssl_verify_ip.result @@ -0,0 +1,4 @@ +1 +1 +1 +1 diff --git a/mysql-test/main/ssl_verify_ip.test b/mysql-test/main/ssl_verify_ip.test new file mode 100644 index 00000000000..2a2e780ecfc --- /dev/null +++ b/mysql-test/main/ssl_verify_ip.test @@ -0,0 +1,3 @@ +source include/have_ssl_crypto_functs.inc; +--exec $MYSQL --protocol=tcp --host=127.0.0.1 --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem --ssl --ssl-verify-server-cert -e "select 1" +--exec $MYSQL --protocol=tcp --host=localhost --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem --ssl --ssl-verify-server-cert -e "select 1" diff --git a/mysql-test/main/stat_tables.result b/mysql-test/main/stat_tables.result index 642dc1fc8f3..bbfb3c15b91 100644 --- a/mysql-test/main/stat_tables.result +++ b/mysql-test/main/stat_tables.result @@ -695,6 +695,54 @@ USE test; delete from mysql.table_stats; delete from mysql.column_stats; delete from mysql.index_stats; +# +# MDEV-19352: Server crash in alloc_histograms_for_table_share upon query from information schema +# +use test; +set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity; +set @@optimizer_use_condition_selectivity= 4; +set use_stat_tables='preferably'; +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (b INT); +CREATE VIEW v AS SELECT * FROM t1 JOIN t2; +INSERT INTO t2 SELECT * FROM x; +ERROR 42S02: Table 'test.x' doesn't exist +select * from information_schema.tables where table_name='v'; +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE VERSION ROW_FORMAT TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE AUTO_INCREMENT CREATE_TIME UPDATE_TIME CHECK_TIME TABLE_COLLATION CHECKSUM CREATE_OPTIONS TABLE_COMMENT MAX_INDEX_LENGTH TEMPORARY +def test v VIEW NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL VIEW NULL NULL +set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; +drop table t1,t2; +drop view v; +# +# MDEV-19407: Assertion `field->table->stats_is_read' failed in is_eits_usable +# +set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity; +set @@optimizer_use_condition_selectivity= 1; +set @@use_stat_tables='never'; +create table t1(pk int); +insert into t1 values (4),(3); +set @@optimizer_use_condition_selectivity= 4; +set use_stat_tables='preferably'; +INSERT INTO t1 SELECT * FROM x; +ERROR 42S02: Table 'test.x' doesn't exist +CREATE TABLE t2 SELECT pk FROM t1 WHERE pk>2; +select * from t2; +pk +4 +3 +drop table t1,t2; +create table t1(a int,b int, key k1(a) ); +insert into t1 values(1,1),(2,2),(3,3); +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +select * from mysql.index_stats, t1 where index_name='k1' and t1.a > 1 and t1.b > 1; +db_name table_name index_name prefix_arity avg_frequency a b +test t1 k1 1 1.0000 2 2 +test t1 k1 1 1.0000 3 3 +drop table t1; +set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; set @save_optimizer_switch=@@optimizer_switch; set use_stat_tables=@save_use_stat_tables; # diff --git a/mysql-test/main/stat_tables.test b/mysql-test/main/stat_tables.test index d845bcd95e7..b5a804598a4 100644 --- a/mysql-test/main/stat_tables.test +++ b/mysql-test/main/stat_tables.test @@ -457,6 +457,53 @@ delete from mysql.table_stats; delete from mysql.column_stats; delete from mysql.index_stats; +--echo # +--echo # MDEV-19352: Server crash in alloc_histograms_for_table_share upon query from information schema +--echo # + +use test; +set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity; +set @@optimizer_use_condition_selectivity= 4; +set use_stat_tables='preferably'; + +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (b INT); +CREATE VIEW v AS SELECT * FROM t1 JOIN t2; +--error ER_NO_SUCH_TABLE +INSERT INTO t2 SELECT * FROM x; + +select * from information_schema.tables where table_name='v'; +set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; + +drop table t1,t2; +drop view v; + +--echo # +--echo # MDEV-19407: Assertion `field->table->stats_is_read' failed in is_eits_usable +--echo # + +set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity; +set @@optimizer_use_condition_selectivity= 1; +set @@use_stat_tables='never'; +create table t1(pk int); +insert into t1 values (4),(3); +set @@optimizer_use_condition_selectivity= 4; +set use_stat_tables='preferably'; + +--error ER_NO_SUCH_TABLE +INSERT INTO t1 SELECT * FROM x; +CREATE TABLE t2 SELECT pk FROM t1 WHERE pk>2; +select * from t2; +drop table t1,t2; + +create table t1(a int,b int, key k1(a) ); +insert into t1 values(1,1),(2,2),(3,3); +analyze table t1; +select * from mysql.index_stats, t1 where index_name='k1' and t1.a > 1 and t1.b > 1; +drop table t1; + +set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; + set @save_optimizer_switch=@@optimizer_switch; set use_stat_tables=@save_use_stat_tables; diff --git a/mysql-test/main/stat_tables_innodb.result b/mysql-test/main/stat_tables_innodb.result index 9d0ea179755..c6c0ccad60c 100644 --- a/mysql-test/main/stat_tables_innodb.result +++ b/mysql-test/main/stat_tables_innodb.result @@ -727,6 +727,54 @@ USE test; delete from mysql.table_stats; delete from mysql.column_stats; delete from mysql.index_stats; +# +# MDEV-19352: Server crash in alloc_histograms_for_table_share upon query from information schema +# +use test; +set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity; +set @@optimizer_use_condition_selectivity= 4; +set use_stat_tables='preferably'; +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (b INT); +CREATE VIEW v AS SELECT * FROM t1 JOIN t2; +INSERT INTO t2 SELECT * FROM x; +ERROR 42S02: Table 'test.x' doesn't exist +select * from information_schema.tables where table_name='v'; +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE VERSION ROW_FORMAT TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE AUTO_INCREMENT CREATE_TIME UPDATE_TIME CHECK_TIME TABLE_COLLATION CHECKSUM CREATE_OPTIONS TABLE_COMMENT MAX_INDEX_LENGTH TEMPORARY +def test v VIEW NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL VIEW NULL NULL +set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; +drop table t1,t2; +drop view v; +# +# MDEV-19407: Assertion `field->table->stats_is_read' failed in is_eits_usable +# +set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity; +set @@optimizer_use_condition_selectivity= 1; +set @@use_stat_tables='never'; +create table t1(pk int); +insert into t1 values (4),(3); +set @@optimizer_use_condition_selectivity= 4; +set use_stat_tables='preferably'; +INSERT INTO t1 SELECT * FROM x; +ERROR 42S02: Table 'test.x' doesn't exist +CREATE TABLE t2 SELECT pk FROM t1 WHERE pk>2; +select * from t2; +pk +4 +3 +drop table t1,t2; +create table t1(a int,b int, key k1(a) ); +insert into t1 values(1,1),(2,2),(3,3); +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +select * from mysql.index_stats, t1 where index_name='k1' and t1.a > 1 and t1.b > 1; +db_name table_name index_name prefix_arity avg_frequency a b +test t1 k1 1 1.0000 2 2 +test t1 k1 1 1.0000 3 3 +drop table t1; +set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; set @save_optimizer_switch=@@optimizer_switch; set use_stat_tables=@save_use_stat_tables; # diff --git a/mysql-test/main/statistics.result b/mysql-test/main/statistics.result index 787f0194532..bda178214b8 100644 --- a/mysql-test/main/statistics.result +++ b/mysql-test/main/statistics.result @@ -1737,6 +1737,20 @@ rename table t1 to t2, t3 to t4; ERROR 42S02: Table 'test.t3' doesn't exist drop table t1, mysql.table_stats; rename table test.table_stats to mysql.table_stats; +# +# MDEV-19334: bool is_eits_usable(Field*): Assertion `field->table->stats_is_read' failed. +# +create temporary table t1(a int); +insert into t1 values (1),(2),(3); +set use_stat_tables=preferably; +set @optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity; +set optimizer_use_condition_selectivity=4; +select * from t1 where a >= 2; +a +2 +3 +drop table t1; +set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; set use_stat_tables=@save_use_stat_tables; # # Start of 10.2 tests diff --git a/mysql-test/main/statistics.test b/mysql-test/main/statistics.test index 880f2987b50..d1546be6bf5 100644 --- a/mysql-test/main/statistics.test +++ b/mysql-test/main/statistics.test @@ -880,6 +880,21 @@ rename table t1 to t2, t3 to t4; drop table t1, mysql.table_stats; rename table test.table_stats to mysql.table_stats; +--echo # +--echo # MDEV-19334: bool is_eits_usable(Field*): Assertion `field->table->stats_is_read' failed. +--echo # + +create temporary table t1(a int); +insert into t1 values (1),(2),(3); + +set use_stat_tables=preferably; +set @optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity; +set optimizer_use_condition_selectivity=4; + +select * from t1 where a >= 2; +drop table t1; +set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; + set use_stat_tables=@save_use_stat_tables; --echo # diff --git a/mysql-test/main/status2.result b/mysql-test/main/status2.result index 5805818fdf5..fa0fc4e1061 100644 --- a/mysql-test/main/status2.result +++ b/mysql-test/main/status2.result @@ -15,10 +15,10 @@ BEGIN SELECT 1; END $$ DROP TABLE IF EXISTS t1,t2; -CREATE TABLE t1 (c1 INT); -CREATE TABLE t2 (c1 INT); CREATE EVENT ev1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO t1 VALUES(1); +CREATE TABLE t1 (c1 INT); +CREATE TABLE t2 (c1 INT); Assert Questions == 7 SHOW STATUS LIKE 'Questions'; Variable_name Value diff --git a/mysql-test/main/status2.test b/mysql-test/main/status2.test index 2d1541c54f2..fa3b718efaa 100644 --- a/mysql-test/main/status2.test +++ b/mysql-test/main/status2.test @@ -20,11 +20,11 @@ END $$ DELIMITER ;$$ --disable_warnings DROP TABLE IF EXISTS t1,t2; +CREATE EVENT ev1 ON SCHEDULE EVERY 1 SECOND + DO INSERT INTO t1 VALUES(1); --enable_warnings CREATE TABLE t1 (c1 INT); CREATE TABLE t2 (c1 INT); -CREATE EVENT ev1 ON SCHEDULE EVERY 1 SECOND - DO INSERT INTO t1 VALUES(1); --echo Assert Questions == 7 SHOW STATUS LIKE 'Questions'; diff --git a/mysql-test/main/table_value_constr.result b/mysql-test/main/table_value_constr.result index 1d485af4a4d..51198ea47d6 100644 --- a/mysql-test/main/table_value_constr.result +++ b/mysql-test/main/table_value_constr.result @@ -2189,3 +2189,400 @@ EXECUTE stmt; 1 + 1 2 abc 2 2 abc DEALLOCATE PREPARE stmt; +# +# MDEV-17894: tvc with ORDER BY ... LIMIT +# +values (5), (7), (1), (3), (4) limit 2; +5 +5 +7 +explain extended values (5), (7), (1), (3), (4) limit 2; +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 values (5),(7),(1),(3),(4) limit 2 +values (5), (7), (1), (3), (4) limit 2 offset 1; +5 +7 +1 +explain extended values (5), (7), (1), (3), (4) limit 2 offset 1; +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 values (5),(7),(1),(3),(4) limit 1,2 +values (5), (7), (1), (3), (4) order by 1 limit 2; +5 +1 +3 +explain extended values (5), (7), (1), (3), (4) order by 1 limit 2; +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 +NULL UNIT RESULT <unit1> ALL NULL NULL NULL NULL NULL NULL Using filesort +Warnings: +Note 1003 values (5),(7),(1),(3),(4) order by 1 limit 2 +values (5), (7), (1), (3), (4) order by 1 limit 2 offset 1; +5 +3 +4 +explain extended values (5), (7), (1), (3), (4) order by 1 limit 2 offset 1; +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 +NULL UNIT RESULT <unit1> ALL NULL NULL NULL NULL NULL NULL Using filesort +Warnings: +Note 1003 values (5),(7),(1),(3),(4) order by 1 limit 1,2 +values (5), (7), (1), (3), (4) order by 1; +5 +1 +3 +4 +5 +7 +explain extended values (5), (7), (1), (3), (4) order by 1; +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 +NULL UNIT RESULT <unit1> ALL NULL NULL NULL NULL NULL NULL Using filesort +Warnings: +Note 1003 values (5),(7),(1),(3),(4) order by 1 +values (5,90), (7,20), (1,70), (3,50), (4,10) order by 2; +5 90 +4 10 +7 20 +3 50 +1 70 +5 90 +explain extended values (5,90), (7,20), (1,70), (3,50), (4,10) order by 2; +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 +NULL UNIT RESULT <unit1> ALL NULL NULL NULL NULL NULL NULL Using filesort +Warnings: +Note 1003 values (5,90),(7,20),(1,70),(3,50),(4,10) order by 2 +select 2 union (values (5), (7), (1), (3), (4) limit 2); +2 +2 +5 +7 +explain extended select 2 union (values (5), (7), (1), (3), (4) limit 2); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL NULL +Warnings: +Note 1003 /* select#1 */ select 2 AS `2` union (values (5),(7),(1),(3),(4) limit 2) +select 2 union (values (5), (7), (1), (3), (4) limit 2 offset 1); +2 +2 +7 +1 +explain extended select 2 union (values (5), (7), (1), (3), (4) limit 2 offset 1); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL NULL +Warnings: +Note 1003 /* select#1 */ select 2 AS `2` union (values (5),(7),(1),(3),(4) limit 1,2) +select 2 union (values (5), (7), (1), (3), (4) order by 1 limit 2); +2 +2 +1 +3 +explain extended select 2 union (values (5), (7), (1), (3), (4) order by 1 limit 2); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 UNION <derived2> ALL NULL NULL NULL NULL 5 100.00 Using filesort +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union1,3> ALL NULL NULL NULL NULL NULL NULL +Warnings: +Note 1003 /* select#1 */ select 2 AS `2` union (/* select#3 */ select `tvc_0`.`5` AS `5` from (values (5),(7),(1),(3),(4)) `tvc_0` order by 1 limit 2) +select 2 union (values (5), (7), (1), (3), (4) order by 1 limit 2 offset 1); +2 +2 +3 +4 +explain extended select 2 union (values (5), (7), (1), (3), (4) order by 1 limit 2 offset 1); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 UNION <derived2> ALL NULL NULL NULL NULL 5 100.00 Using filesort +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union1,3> ALL NULL NULL NULL NULL NULL NULL +Warnings: +Note 1003 /* select#1 */ select 2 AS `2` union (/* select#3 */ select `tvc_0`.`5` AS `5` from (values (5),(7),(1),(3),(4)) `tvc_0` order by 1 limit 1,2) +(values (5), (7), (1), (3), (4) limit 2) union select 2; +5 +5 +7 +2 +explain extended (values (5), (7), (1), (3), (4) limit 2) union select 2; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL NULL +Warnings: +Note 1003 (values (5),(7),(1),(3),(4) limit 2) union /* select#2 */ select 2 AS `2` +(values (5), (7), (1), (3), (4) limit 2 offset 1) union select 2; +5 +7 +1 +2 +explain extended (values (5), (7), (1), (3), (4) limit 2 offset 1) union select 2; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL NULL +Warnings: +Note 1003 (values (5),(7),(1),(3),(4) limit 1,2) union /* select#2 */ select 2 AS `2` +(values (5), (7), (1), (3), (4) order by 1 limit 2) union select 2; +5 +1 +3 +2 +explain extended (values (5), (7), (1), (3), (4) order by 1 limit 2) union select 2; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived3> ALL NULL NULL NULL NULL 5 100.00 Using filesort +3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL NULL +Warnings: +Note 1003 (/* select#1 */ select `tvc_0`.`5` AS `5` from (values (5),(7),(1),(3),(4)) `tvc_0` order by 1 limit 2) union /* select#2 */ select 2 AS `2` +(values (5), (7), (1), (3), (4) order by 1 limit 2 offset 1) union select 2; +5 +3 +4 +2 +explain extended (values (5), (7), (1), (3), (4) order by 1 limit 2 offset 1) union select 2; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived3> ALL NULL NULL NULL NULL 5 100.00 Using filesort +3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL NULL +Warnings: +Note 1003 (/* select#1 */ select `tvc_0`.`5` AS `5` from (values (5),(7),(1),(3),(4)) `tvc_0` order by 1 limit 1,2) union /* select#2 */ select 2 AS `2` +select 3 union all (values (5), (7), (1), (3), (4) limit 2 offset 3); +3 +3 +3 +4 +explain extended select 3 union all (values (5), (7), (1), (3), (4) limit 2 offset 3); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 /* select#1 */ select 3 AS `3` union all (values (5),(7),(1),(3),(4) limit 3,2) +(values (5), (7), (1), (3), (4) limit 2 offset 3) union all select 3; +5 +3 +4 +3 +explain extended (values (5), (7), (1), (3), (4) limit 2 offset 3) union all select 3; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 (values (5),(7),(1),(3),(4) limit 3,2) union all /* select#2 */ select 3 AS `3` +select 3 union all (values (5), (7), (1), (3), (4) order by 1 limit 2); +3 +3 +1 +3 +explain extended select 3 union all (values (5), (7), (1), (3), (4) order by 1 limit 2); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 UNION <derived2> ALL NULL NULL NULL NULL 5 100.00 Using filesort +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union1,3> ALL NULL NULL NULL NULL NULL NULL +Warnings: +Note 1003 /* select#1 */ select 3 AS `3` union all (/* select#3 */ select `tvc_0`.`5` AS `5` from (values (5),(7),(1),(3),(4)) `tvc_0` order by 1 limit 2) +(values (5), (7), (1), (3), (4) order by 1 limit 2) union all select 3; +5 +1 +3 +3 +explain extended (values (5), (7), (1), (3), (4) order by 1 limit 2) union all select 3; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived3> ALL NULL NULL NULL NULL 5 100.00 Using filesort +3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL NULL +Warnings: +Note 1003 (/* select#1 */ select `tvc_0`.`5` AS `5` from (values (5),(7),(1),(3),(4)) `tvc_0` order by 1 limit 2) union all /* select#2 */ select 3 AS `3` +( values (5), (7), (1), (3), (4) limit 2 offset 1 ) +union +( values (5), (7), (1), (3), (4) order by 1 limit 2 ); +5 +7 +1 +3 +explain extended ( values (5), (7), (1), (3), (4) limit 2 offset 1 ) +union +( values (5), (7), (1), (3), (4) order by 1 limit 2 ); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 UNION <derived2> ALL NULL NULL NULL NULL 5 100.00 Using filesort +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union1,3> ALL NULL NULL NULL NULL NULL NULL +Warnings: +Note 1003 (values (5),(7),(1),(3),(4) limit 1,2) union (/* select#3 */ select `tvc_0`.`5` AS `5` from (values (5),(7),(1),(3),(4)) `tvc_0` order by 1 limit 2) +( values (5), (7), (1), (3), (4) limit 2 offset 1 ) +union all +( values (5), (7), (1), (3), (4) order by 1 limit 2 ); +5 +7 +1 +1 +3 +explain extended ( values (5), (7), (1), (3), (4) limit 2 offset 1 ) +union all +( values (5), (7), (1), (3), (4) order by 1 limit 2 ); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 UNION <derived2> ALL NULL NULL NULL NULL 5 100.00 Using filesort +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union1,3> ALL NULL NULL NULL NULL NULL NULL +Warnings: +Note 1003 (values (5),(7),(1),(3),(4) limit 1,2) union all (/* select#3 */ select `tvc_0`.`5` AS `5` from (values (5),(7),(1),(3),(4)) `tvc_0` order by 1 limit 2) +(values (5), (7), (1), (3), (4) limit 2 offset 3) union all select 3 order by 1; +5 +3 +3 +4 +explain extended (values (5), (7), (1), (3), (4) limit 2 offset 3) union all select 3 order by 1; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL NULL Using filesort +Warnings: +Note 1003 (values (5),(7),(1),(3),(4) limit 3,2) union all /* select#2 */ select 3 AS `3` order by 1 +(values (5), (7), (1), (3), (4) order by 1 limit 3 offset 1) union all select 3 order by 1; +5 +3 +3 +4 +5 +explain extended (values (5), (7), (1), (3), (4) order by 1 limit 3 offset 1) union all select 3 order by 1; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived3> ALL NULL NULL NULL NULL 5 100.00 Using filesort +3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL NULL Using filesort +Warnings: +Note 1003 (/* select#1 */ select `tvc_0`.`5` AS `5` from (values (5),(7),(1),(3),(4)) `tvc_0` order by 1 limit 1,3) union all /* select#2 */ select 3 AS `3` order by 1 +(values (5), (7), (1), (3), (4) order by 1 limit 3 offset 1) union all select 3 +order by 1 limit 2 offset 1; +5 +3 +4 +explain extended (values (5), (7), (1), (3), (4) order by 1 limit 3 offset 1) union all select 3 +order by 1 limit 2 offset 1; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived3> ALL NULL NULL NULL NULL 5 100.00 Using filesort +3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL NULL Using filesort +Warnings: +Note 1003 (/* select#1 */ select `tvc_0`.`5` AS `5` from (values (5),(7),(1),(3),(4)) `tvc_0` order by 1 limit 1,3) union all /* select#2 */ select 3 AS `3` order by 1 limit 1,2 +values (5,90), (7,20), (1,70), (3,50), (4,10) order by 3; +ERROR 42S22: Unknown column '3' in 'order clause' +prepare stmt from " +select 2 union (values (5), (7), (1), (3), (4) limit 2) +"; +execute stmt; +2 +2 +5 +7 +execute stmt; +2 +2 +5 +7 +deallocate prepare stmt; +prepare stmt from " +select 2 union (values (5), (7), (1), (3), (4) order by 1 limit 2) +"; +execute stmt; +2 +2 +1 +3 +execute stmt; +2 +2 +1 +3 +deallocate prepare stmt; +prepare stmt from " +select 3 union all (values (5), (7), (1), (3), (4) limit 2) +"; +execute stmt; +3 +3 +5 +7 +execute stmt; +3 +3 +5 +7 +deallocate prepare stmt; +prepare stmt from " +select 3 union all (values (5), (7), (1), (3), (4) order by 1 limit 2) +"; +execute stmt; +3 +3 +1 +3 +execute stmt; +3 +3 +1 +3 +deallocate prepare stmt; +prepare stmt from " +( values (5), (7), (1), (3), (4) limit 2 offset 1 ) + union +( values (5), (7), (1), (3), (4) order by 1 limit 2 ); +"; +execute stmt; +5 +7 +1 +3 +execute stmt; +5 +7 +1 +3 +deallocate prepare stmt; +prepare stmt from " +values (5,90), (7,20), (1,70), (3,50), (4,10) order by 3; +"; +ERROR 42S22: Unknown column '3' in 'order clause' +create view v1 as values (5), (7), (1), (3), (4) order by 1 limit 2; +show create view v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS values (5),(7),(1),(3),(4) order by 1 limit 2 latin1 latin1_swedish_ci +select * from v1; +5 +1 +3 +drop view v1; +create view v1 as +( values (5), (7), (1), (3), (4) limit 2 offset 1 ) +union +( values (5), (7), (1), (3), (4) order by 1 limit 2 ); +show create view v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS (values (5),(7),(1),(3),(4) limit 1,2) union (values (5),(7),(1),(3),(4) order by 1 limit 2) latin1 latin1_swedish_ci +select * from v1; +5 +7 +1 +3 +drop view v1; +create view v1 as values (5,90), (7,20), (1,70), (3,50), (4,10) order by 3; +ERROR 42S22: Unknown column '3' in 'order clause' +create view v1 as +( values (5), (7), (1), (3), (4) limit 2 offset 1 ) +union +( values (5), (7), (1), (3), (4) order by 2 limit 2 ); +ERROR 42S22: Unknown column '2' in 'order clause' diff --git a/mysql-test/main/table_value_constr.test b/mysql-test/main/table_value_constr.test index 0dd0a7a04b0..6b89816cc0c 100644 --- a/mysql-test/main/table_value_constr.test +++ b/mysql-test/main/table_value_constr.test @@ -1123,3 +1123,196 @@ PREPARE stmt FROM "SELECT * FROM (VALUES(1 + 1,2,'abc')) t"; EXECUTE stmt; EXECUTE stmt; DEALLOCATE PREPARE stmt; + +--echo # +--echo # MDEV-17894: tvc with ORDER BY ... LIMIT +--echo # + +let $q= +values (5), (7), (1), (3), (4) limit 2; +eval $q; +eval explain extended $q; + +let $q= +values (5), (7), (1), (3), (4) limit 2 offset 1; +eval $q; +eval explain extended $q; + +let $q= +values (5), (7), (1), (3), (4) order by 1 limit 2; +eval $q; +eval explain extended $q; + +let $q= +values (5), (7), (1), (3), (4) order by 1 limit 2 offset 1; +eval $q; +eval explain extended $q; + +let $q= +values (5), (7), (1), (3), (4) order by 1; +eval $q; +eval explain extended $q; + +let $q= +values (5,90), (7,20), (1,70), (3,50), (4,10) order by 2; +eval $q; +eval explain extended $q; + +let $q= +select 2 union (values (5), (7), (1), (3), (4) limit 2); +eval $q; +eval explain extended $q; + +let $q= +select 2 union (values (5), (7), (1), (3), (4) limit 2 offset 1); +eval $q; +eval explain extended $q; + +let $q= +select 2 union (values (5), (7), (1), (3), (4) order by 1 limit 2); +eval $q; +eval explain extended $q; + +let $q= +select 2 union (values (5), (7), (1), (3), (4) order by 1 limit 2 offset 1); +eval $q; +eval explain extended $q; + + +let $q= +(values (5), (7), (1), (3), (4) limit 2) union select 2; +eval $q; +eval explain extended $q; + +let $q= +(values (5), (7), (1), (3), (4) limit 2 offset 1) union select 2; +eval $q; +eval explain extended $q; + +let $q= +(values (5), (7), (1), (3), (4) order by 1 limit 2) union select 2; +eval $q; +eval explain extended $q; + +let $q= +(values (5), (7), (1), (3), (4) order by 1 limit 2 offset 1) union select 2; +eval $q; +eval explain extended $q; + + +let $q= +select 3 union all (values (5), (7), (1), (3), (4) limit 2 offset 3); +eval $q; +eval explain extended $q; + +let $q= +(values (5), (7), (1), (3), (4) limit 2 offset 3) union all select 3; +eval $q; +eval explain extended $q; + +let $q= +select 3 union all (values (5), (7), (1), (3), (4) order by 1 limit 2); +eval $q; +eval explain extended $q; + +let $q= +(values (5), (7), (1), (3), (4) order by 1 limit 2) union all select 3; +eval $q; +eval explain extended $q; + +let $q= +( values (5), (7), (1), (3), (4) limit 2 offset 1 ) + union +( values (5), (7), (1), (3), (4) order by 1 limit 2 ); +eval $q; +eval explain extended $q; + +let $q= +( values (5), (7), (1), (3), (4) limit 2 offset 1 ) + union all +( values (5), (7), (1), (3), (4) order by 1 limit 2 ); +eval $q; +eval explain extended $q; + +let $q= +(values (5), (7), (1), (3), (4) limit 2 offset 3) union all select 3 order by 1; +eval $q; +eval explain extended $q; + +let $q= +(values (5), (7), (1), (3), (4) order by 1 limit 3 offset 1) union all select 3 order by 1; +eval $q; +eval explain extended $q; + +let $q= +(values (5), (7), (1), (3), (4) order by 1 limit 3 offset 1) union all select 3 + order by 1 limit 2 offset 1; +eval $q; +eval explain extended $q; + +--error ER_BAD_FIELD_ERROR +values (5,90), (7,20), (1,70), (3,50), (4,10) order by 3; + +prepare stmt from " +select 2 union (values (5), (7), (1), (3), (4) limit 2) +"; +execute stmt; +execute stmt; +deallocate prepare stmt; + +prepare stmt from " +select 2 union (values (5), (7), (1), (3), (4) order by 1 limit 2) +"; +execute stmt; +execute stmt; +deallocate prepare stmt; + +prepare stmt from " +select 3 union all (values (5), (7), (1), (3), (4) limit 2) +"; +execute stmt; +execute stmt; +deallocate prepare stmt; + +prepare stmt from " +select 3 union all (values (5), (7), (1), (3), (4) order by 1 limit 2) +"; +execute stmt; +execute stmt; +deallocate prepare stmt; + +prepare stmt from " +( values (5), (7), (1), (3), (4) limit 2 offset 1 ) + union +( values (5), (7), (1), (3), (4) order by 1 limit 2 ); +"; +execute stmt; +execute stmt; +deallocate prepare stmt; + +--error ER_BAD_FIELD_ERROR +prepare stmt from " +values (5,90), (7,20), (1,70), (3,50), (4,10) order by 3; +"; + +create view v1 as values (5), (7), (1), (3), (4) order by 1 limit 2; +show create view v1; +select * from v1; +drop view v1; + +create view v1 as +( values (5), (7), (1), (3), (4) limit 2 offset 1 ) + union +( values (5), (7), (1), (3), (4) order by 1 limit 2 ); +show create view v1; +select * from v1; +drop view v1; + +--error ER_BAD_FIELD_ERROR +create view v1 as values (5,90), (7,20), (1,70), (3,50), (4,10) order by 3; + +--error ER_BAD_FIELD_ERROR +create view v1 as +( values (5), (7), (1), (3), (4) limit 2 offset 1 ) + union +( values (5), (7), (1), (3), (4) order by 2 limit 2 ); diff --git a/mysql-test/main/temp_table.result b/mysql-test/main/temp_table.result index 5de86e47fb1..69f3b8e5155 100644 --- a/mysql-test/main/temp_table.result +++ b/mysql-test/main/temp_table.result @@ -572,3 +572,15 @@ LOCK TABLES t2 WRITE; TRUNCATE TABLE t1; UNLOCK TABLES; DROP TABLE t1, t2; +# +# MDEV-19449 1030: Got error 168 "Unknown (generic) error from engine" +# for valid TRUNCATE (temporary) TABLE +# +CREATE TEMPORARY TABLE t1 (col1 BIGINT) ENGINE = InnoDB; +INSERT INTO t1 (no_such_col) SELECT * FROM t1; +ERROR 42S22: Unknown column 'no_such_col' in 'field list' +TRUNCATE TABLE t1; +ALTER TABLE t1 CHANGE no_such_col1 col1 BIGINT NULL; +ERROR 42S22: Unknown column 'no_such_col1' in 't1' +TRUNCATE TABLE t1; +DROP TEMPORARY TABLE t1; diff --git a/mysql-test/main/temp_table.test b/mysql-test/main/temp_table.test index a1e61b31a82..bd3bba34f89 100644 --- a/mysql-test/main/temp_table.test +++ b/mysql-test/main/temp_table.test @@ -623,3 +623,19 @@ TRUNCATE TABLE t1; UNLOCK TABLES; DROP TABLE t1, t2; + +--echo # +--echo # MDEV-19449 1030: Got error 168 "Unknown (generic) error from engine" +--echo # for valid TRUNCATE (temporary) TABLE +--echo # + +CREATE TEMPORARY TABLE t1 (col1 BIGINT) ENGINE = InnoDB; +--error ER_BAD_FIELD_ERROR +INSERT INTO t1 (no_such_col) SELECT * FROM t1; +TRUNCATE TABLE t1; +--error ER_BAD_FIELD_ERROR +ALTER TABLE t1 CHANGE no_such_col1 col1 BIGINT NULL; +# This would wrongly try to re-truncate the old copy of the table that +# was not dropped during the first TRUNCATE due to extra table handles. +TRUNCATE TABLE t1; +DROP TEMPORARY TABLE t1; diff --git a/mysql-test/main/timezone2.result b/mysql-test/main/timezone2.result index dd137045d1a..cf3c6e01e25 100644 --- a/mysql-test/main/timezone2.result +++ b/mysql-test/main/timezone2.result @@ -333,6 +333,39 @@ NULL # End of 5.3 tests # # +# Start of 10.1 tests +# +# +# MDEV-11895 NO_ZERO_DATE affects timestamp values without any warnings +# +SET sql_mode = ''; +CREATE TABLE t1 (a TIMESTAMP NULL) ENGINE = MyISAM; +CREATE TABLE t2 (a TIMESTAMP NULL) ENGINE = MyISAM; +CREATE TABLE t3 (a TIMESTAMP NULL) ENGINE = MyISAM; +SET @@session.time_zone = 'UTC'; +INSERT INTO t1 VALUES ('2011-10-29 23:00:00'); +INSERT INTO t1 VALUES ('2011-10-29 23:00:01'); +INSERT INTO t1 VALUES ('2011-10-29 23:59:59'); +SET @@session.time_zone = 'Europe/Moscow'; +SET sql_mode='NO_ZERO_DATE'; +INSERT INTO t2 SELECT * FROM t1; +SET sql_mode=''; +INSERT INTO t3 SELECT * FROM t1; +SELECT UNIX_TIMESTAMP(a), a FROM t2; +UNIX_TIMESTAMP(a) a +1319929200 2011-10-30 02:00:00 +1319929201 2011-10-30 02:00:01 +1319932799 2011-10-30 02:59:59 +SELECT UNIX_TIMESTAMP(a), a FROM t3; +UNIX_TIMESTAMP(a) a +1319929200 2011-10-30 02:00:00 +1319929201 2011-10-30 02:00:01 +1319932799 2011-10-30 02:59:59 +DROP TABLE t1, t2, t3; +# +# End of 10.1 tests +# +# # Start of 10.4 tests # # diff --git a/mysql-test/main/timezone2.test b/mysql-test/main/timezone2.test index db515653651..e945923da7a 100644 --- a/mysql-test/main/timezone2.test +++ b/mysql-test/main/timezone2.test @@ -310,6 +310,37 @@ SELECT CONVERT_TZ('2001-10-08 00:00:00', MAKE_SET(0,'+01:00'), '+00:00' ); --echo # --echo # +--echo # Start of 10.1 tests +--echo # + +--echo # +--echo # MDEV-11895 NO_ZERO_DATE affects timestamp values without any warnings +--echo # + +SET sql_mode = ''; +CREATE TABLE t1 (a TIMESTAMP NULL) ENGINE = MyISAM; +CREATE TABLE t2 (a TIMESTAMP NULL) ENGINE = MyISAM; +CREATE TABLE t3 (a TIMESTAMP NULL) ENGINE = MyISAM; + +SET @@session.time_zone = 'UTC'; +INSERT INTO t1 VALUES ('2011-10-29 23:00:00'); +INSERT INTO t1 VALUES ('2011-10-29 23:00:01'); +INSERT INTO t1 VALUES ('2011-10-29 23:59:59'); + +SET @@session.time_zone = 'Europe/Moscow'; +SET sql_mode='NO_ZERO_DATE'; +INSERT INTO t2 SELECT * FROM t1; +SET sql_mode=''; +INSERT INTO t3 SELECT * FROM t1; +SELECT UNIX_TIMESTAMP(a), a FROM t2; +SELECT UNIX_TIMESTAMP(a), a FROM t3; +DROP TABLE t1, t2, t3; + +--echo # +--echo # End of 10.1 tests +--echo # + +--echo # --echo # Start of 10.4 tests --echo # diff --git a/mysql-test/main/type_bit.result b/mysql-test/main/type_bit.result index c2db7ee7178..2964f400f10 100644 --- a/mysql-test/main/type_bit.result +++ b/mysql-test/main/type_bit.result @@ -835,6 +835,13 @@ COALESCE(val, 1) 0 DROP TABLE t1; # +# MDEV-18452 ASAN unknown-crash in Field::set_default upon SET bit_column = DEFAULT +# +CREATE TABLE t1 (b BIT(20)) ENGINE=MyISAM; +INSERT INTO t1 VALUES (0); +UPDATE t1 SET b = DEFAULT; +DROP TABLE t1; +# # End of 10.1 tests # # diff --git a/mysql-test/main/type_bit.test b/mysql-test/main/type_bit.test index ee14b38ada0..d0644b764ae 100644 --- a/mysql-test/main/type_bit.test +++ b/mysql-test/main/type_bit.test @@ -461,6 +461,15 @@ SELECT COALESCE(val, 1) FROM t1; DROP TABLE t1; --echo # +--echo # MDEV-18452 ASAN unknown-crash in Field::set_default upon SET bit_column = DEFAULT +--echo # + +CREATE TABLE t1 (b BIT(20)) ENGINE=MyISAM; +INSERT INTO t1 VALUES (0); +UPDATE t1 SET b = DEFAULT; +DROP TABLE t1; + +--echo # --echo # End of 10.1 tests --echo # diff --git a/mysql-test/main/type_float.result b/mysql-test/main/type_float.result index 0ce54c0126c..167c167ad45 100644 --- a/mysql-test/main/type_float.result +++ b/mysql-test/main/type_float.result @@ -841,7 +841,106 @@ DROP TABLE t1; # End of 10.2 tests # # -# Start of 10.4 tests +# MDEV-19468 Hybrid type expressions return wrong format for FLOAT +# +CREATE TABLE t1 (a FLOAT); +INSERT INTO t1 VALUES (0.671437); +SELECT a, COALESCE(a), MAX(a), LEAST(a,a), (SELECT a FROM t1) AS c FROM t1; +a COALESCE(a) MAX(a) LEAST(a,a) c +0.671437 0.671437 0.671437 0.671437 0.671437 +DROP TABLE t1; +CREATE TABLE t1 (a FLOAT); +INSERT INTO t1 VALUES (0.671437); +SELECT +CONCAT(a), +CONCAT(COALESCE(a)), +CONCAT(LEAST(a,a)), +CONCAT(MAX(a)), +CONCAT((SELECT a FROM t1)) AS c +FROM t1; +CONCAT(a) CONCAT(COALESCE(a)) CONCAT(LEAST(a,a)) CONCAT(MAX(a)) c +0.671437 0.671437 0.671437 0.671437 0.671437 +CREATE TABLE t2 AS SELECT +CONCAT(a), +CONCAT(COALESCE(a)), +CONCAT(LEAST(a,a)), +CONCAT(MAX(a)), +CONCAT((SELECT a FROM t1)) AS c +FROM t1; +SELECT * FROM t2; +CONCAT(a) CONCAT(COALESCE(a)) CONCAT(LEAST(a,a)) CONCAT(MAX(a)) c +0.671437 0.671437 0.671437 0.671437 0.671437 +DROP TABLE t1, t2; +# +# MDEV-16872 Add CAST(expr AS FLOAT) +# +SELECT CAST(0.671437 AS FLOAT), CONCAT(CAST(0.671437 AS FLOAT)); +CAST(0.671437 AS FLOAT) CONCAT(CAST(0.671437 AS FLOAT)) +0.671437 0.671437 +SELECT CAST(1e40 AS FLOAT), CONCAT(CAST(1e40 AS FLOAT)); +CAST(1e40 AS FLOAT) CONCAT(CAST(1e40 AS FLOAT)) +3.40282e38 3.40282e38 +Warnings: +Note 1264 Out of range value for column 'CAST(1e40 AS FLOAT)' at row 1 +Note 1264 Out of range value for column 'CAST(1e40 AS FLOAT)' at row 1 +SELECT CAST(-1e40 AS FLOAT), CONCAT(CAST(-1e40 AS FLOAT)); +CAST(-1e40 AS FLOAT) CONCAT(CAST(-1e40 AS FLOAT)) +-3.40282e38 -3.40282e38 +Warnings: +Note 1264 Out of range value for column 'CAST(-1e40 AS FLOAT)' at row 1 +Note 1264 Out of range value for column 'CAST(-1e40 AS FLOAT)' at row 1 +SET sql_mode='STRICT_ALL_TABLES,STRICT_TRANS_TABLES'; +CREATE TABLE t1 (a FLOAT); +INSERT INTO t1 VALUES (CAST(1e40 AS FLOAT)); +Warnings: +Note 1264 Out of range value for column 'CAST(1e40 AS FLOAT)' at row 1 +SELECT * FROM t1; +a +3.40282e38 +DROP TABLE t1; +SET sql_mode=DEFAULT; +EXPLAIN EXTENDED SELECT CAST(0.671437 AS FLOAT); +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(0.671437 as float) AS `CAST(0.671437 AS FLOAT)` +CREATE TABLE t1 AS SELECT CAST(0.671437 AS FLOAT) AS c1; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` float DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT * FROM t1; +c1 +0.671437 +DROP TABLE t1; +CREATE TABLE t1 (a FLOAT); +CREATE TABLE t2 AS SELECT CONCAT(a) AS c1, CONCAT(CAST(a AS FLOAT)) AS c2 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `c1` varchar(12) DEFAULT NULL, + `c2` varchar(12) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1, t2; +CREATE TABLE t1 (a FLOAT DEFAULT CAST(0.671437 AS FLOAT)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` float DEFAULT (cast(0.671437 as float)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, a FLOAT); +INSERT INTO t1 VALUES (1, 0.671437),(2, 0.671437); +DELETE FROM t1 WHERE a=0.671437; +SELECT * FROM t1; +id a +1 0.671437 +2 0.671437 +DELETE FROM t1 WHERE a=CAST(0.671437 AS FLOAT); +DROP TABLE t1; +# +# End of 10.3 tests # # # MDEV-11362 True condition elimination does not work for DECIMAL and temporal dynamic SQL parameters diff --git a/mysql-test/main/type_float.test b/mysql-test/main/type_float.test index f42d3445e2a..4665c945a76 100644 --- a/mysql-test/main/type_float.test +++ b/mysql-test/main/type_float.test @@ -582,9 +582,76 @@ DROP TABLE t1; --echo # End of 10.2 tests --echo # +--echo # +--echo # MDEV-19468 Hybrid type expressions return wrong format for FLOAT +--echo # + +CREATE TABLE t1 (a FLOAT); +INSERT INTO t1 VALUES (0.671437); +SELECT a, COALESCE(a), MAX(a), LEAST(a,a), (SELECT a FROM t1) AS c FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a FLOAT); +INSERT INTO t1 VALUES (0.671437); +SELECT + CONCAT(a), + CONCAT(COALESCE(a)), + CONCAT(LEAST(a,a)), + CONCAT(MAX(a)), + CONCAT((SELECT a FROM t1)) AS c +FROM t1; +CREATE TABLE t2 AS SELECT + CONCAT(a), + CONCAT(COALESCE(a)), + CONCAT(LEAST(a,a)), + CONCAT(MAX(a)), + CONCAT((SELECT a FROM t1)) AS c +FROM t1; +SELECT * FROM t2; +DROP TABLE t1, t2; + + +--echo # +--echo # MDEV-16872 Add CAST(expr AS FLOAT) +--echo # + +SELECT CAST(0.671437 AS FLOAT), CONCAT(CAST(0.671437 AS FLOAT)); +SELECT CAST(1e40 AS FLOAT), CONCAT(CAST(1e40 AS FLOAT)); +SELECT CAST(-1e40 AS FLOAT), CONCAT(CAST(-1e40 AS FLOAT)); + +SET sql_mode='STRICT_ALL_TABLES,STRICT_TRANS_TABLES'; +CREATE TABLE t1 (a FLOAT); +INSERT INTO t1 VALUES (CAST(1e40 AS FLOAT)); +SELECT * FROM t1; +DROP TABLE t1; +SET sql_mode=DEFAULT; + +EXPLAIN EXTENDED SELECT CAST(0.671437 AS FLOAT); + +CREATE TABLE t1 AS SELECT CAST(0.671437 AS FLOAT) AS c1; +SHOW CREATE TABLE t1; +SELECT * FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a FLOAT); +CREATE TABLE t2 AS SELECT CONCAT(a) AS c1, CONCAT(CAST(a AS FLOAT)) AS c2 FROM t1; +SHOW CREATE TABLE t2; +DROP TABLE t1, t2; + +CREATE TABLE t1 (a FLOAT DEFAULT CAST(0.671437 AS FLOAT)); +SHOW CREATE TABLE t1; +DROP TABLE t1; + +CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, a FLOAT); +INSERT INTO t1 VALUES (1, 0.671437),(2, 0.671437); +DELETE FROM t1 WHERE a=0.671437; +SELECT * FROM t1; +DELETE FROM t1 WHERE a=CAST(0.671437 AS FLOAT); +DROP TABLE t1; + --echo # ---echo # Start of 10.4 tests +--echo # End of 10.3 tests --echo # --echo # diff --git a/mysql-test/main/view_grant.result b/mysql-test/main/view_grant.result index df1429eaa4d..2fa898d9060 100644 --- a/mysql-test/main/view_grant.result +++ b/mysql-test/main/view_grant.result @@ -198,12 +198,15 @@ create table mysqltest.t1 (a int, b int, primary key(a)); insert into mysqltest.t1 values (10,2), (20,3), (30,4), (40,5), (50,10); create table mysqltest.t2 (x int); insert into mysqltest.t2 values (3), (4), (5), (6); +create table mysqltest.t3 (x int); +insert into mysqltest.t3 values (3), (4), (5), (6); create view mysqltest.v1 (a,c) as select a, b+1 from mysqltest.t1; create view mysqltest.v2 (a,c) as select a, b from mysqltest.t1; create view mysqltest.v3 (a,c) as select a, b+1 from mysqltest.t1; create user mysqltest_1@localhost; grant update (a) on mysqltest.v2 to mysqltest_1@localhost; grant update on mysqltest.v1 to mysqltest_1@localhost; +grant update on mysqltest.t3 to mysqltest_1@localhost; grant select on mysqltest.* to mysqltest_1@localhost; connection user1; use mysqltest; @@ -239,6 +242,7 @@ a b 48 4 62 5 71 10 +update t3,v3 set t3.x=t3.x+v3.c where t3.x=v3.c; update t2,v2 set v2.c=v2.a+v2.c where t2.x=v2.c; ERROR 42000: UPDATE command denied to user 'mysqltest_1'@'localhost' for column 'c' in table 'v2' update v2 set c=a+c; diff --git a/mysql-test/main/view_grant.test b/mysql-test/main/view_grant.test index 65757e95fb3..cc17cae58d1 100644 --- a/mysql-test/main/view_grant.test +++ b/mysql-test/main/view_grant.test @@ -244,6 +244,8 @@ create table mysqltest.t1 (a int, b int, primary key(a)); insert into mysqltest.t1 values (10,2), (20,3), (30,4), (40,5), (50,10); create table mysqltest.t2 (x int); insert into mysqltest.t2 values (3), (4), (5), (6); +create table mysqltest.t3 (x int); +insert into mysqltest.t3 values (3), (4), (5), (6); create view mysqltest.v1 (a,c) as select a, b+1 from mysqltest.t1; create view mysqltest.v2 (a,c) as select a, b from mysqltest.t1; create view mysqltest.v3 (a,c) as select a, b+1 from mysqltest.t1; @@ -251,6 +253,7 @@ create view mysqltest.v3 (a,c) as select a, b+1 from mysqltest.t1; create user mysqltest_1@localhost; grant update (a) on mysqltest.v2 to mysqltest_1@localhost; grant update on mysqltest.v1 to mysqltest_1@localhost; +grant update on mysqltest.t3 to mysqltest_1@localhost; grant select on mysqltest.* to mysqltest_1@localhost; connection user1; @@ -265,6 +268,8 @@ update t2,v2 set v2.a=v2.a+v2.c where t2.x=v2.c; select * from t1; update v2 set a=a+c; select * from t1; +# update a table, select only on view +update t3,v3 set t3.x=t3.x+v3.c where t3.x=v3.c; # no rights on column --error ER_COLUMNACCESS_DENIED_ERROR update t2,v2 set v2.c=v2.a+v2.c where t2.x=v2.c; diff --git a/mysql-test/main/win.result b/mysql-test/main/win.result index e9b2a0842f0..85d645359ea 100644 --- a/mysql-test/main/win.result +++ b/mysql-test/main/win.result @@ -3518,6 +3518,95 @@ rank() OVER (ORDER BY 1) ROW_NUMBER() OVER (ORDER BY (EXPORT_SET(5,'Y','N',',',4 1 3 drop table t1; # +# MDEV-17781: Server crashes in next_linear_tab +# +CREATE TABLE t1 (i1 int); +explain +(SELECT AVG(0) OVER (), MAX('2') FROM t1) +UNION ALL +(SELECT AVG(0) OVER (), MAX('2') FROM t1); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used +2 UNION NULL NULL NULL NULL NULL NULL NULL No tables used +(SELECT AVG(0) OVER (), MAX('2') FROM t1) +UNION ALL +(SELECT AVG(0) OVER (), MAX('2') FROM t1); +AVG(0) OVER () MAX('2') +0.0000 NULL +0.0000 NULL +drop table t1; +# +# MDEV-14791: Crash with order by expression containing window functions +# +CREATE TABLE t1 (b1 int, b2 int); +INSERT INTO t1 VALUES (1,1),(0,0); +explain +SELECT b1 from t1 order by row_number() over (ORDER BY b2) + 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort +SELECT b1 from t1 order by row_number() over (ORDER BY b2) + 1; +b1 +0 +1 +explain +SELECT b1 from t1 order by row_number() over (ORDER BY b2); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort +SELECT b1 from t1 order by row_number() over (ORDER BY b2); +b1 +0 +1 +DROP TABLE t1; +CREATE TABLE t1 (a int, b int, c int); +INSERT INTO t1 VALUES (2,3,207), (1,21,909), (7,13,312), (8,64,248); +explain +SELECT * FROM t1 ORDER BY max(t1.a) over (partition by c); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using temporary; Using filesort +SELECT * FROM t1 ORDER BY max(t1.a) over (partition by c); +a b c +1 21 909 +2 3 207 +7 13 312 +8 64 248 +explain +SELECT max(t1.a) over (partition by c) as x, b, c from t1 order by max(t1.a) over (partition by c); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using temporary; Using filesort +SELECT max(t1.a) over (partition by c) as x, b, c from t1 order by max(t1.a) over (partition by c); +x b c +1 21 909 +2 3 207 +7 13 312 +8 64 248 +drop table t1; +# +# MDEV-18373: DENSE_RANK is not calculated correctly +# +create table t1 (a int, b int); +insert into t1 values (60, 1515),(60, 2000),(70, 2000),(55, 1600); +select b, dense_rank() over (order by sum(a)) from t1 group by b; +b dense_rank() over (order by sum(a)) +1515 2 +1600 1 +2000 3 +select b, dense_rank() over (order by sum(a)+1) from t1 group by b; +b dense_rank() over (order by sum(a)+1) +1515 2 +1600 1 +2000 3 +select b, row_number() over (partition by sum(a)) from t1 group by b; +b row_number() over (partition by sum(a)) +1515 1 +1600 1 +2000 1 +select b, row_number() over (partition by sum(a)+1) from t1 group by b; +b row_number() over (partition by sum(a)+1) +1515 1 +1600 1 +2000 1 +drop table t1; +# # End of 10.2 tests # # diff --git a/mysql-test/main/win.test b/mysql-test/main/win.test index c68e80614b6..c5c5215b215 100644 --- a/mysql-test/main/win.test +++ b/mysql-test/main/win.test @@ -2266,6 +2266,66 @@ SELECT rank() OVER (ORDER BY 1), ROW_NUMBER() OVER (ORDER BY (EXPORT_SET(5,'Y', drop table t1; --echo # +--echo # MDEV-17781: Server crashes in next_linear_tab +--echo # + +CREATE TABLE t1 (i1 int); +explain +(SELECT AVG(0) OVER (), MAX('2') FROM t1) +UNION ALL +(SELECT AVG(0) OVER (), MAX('2') FROM t1); +(SELECT AVG(0) OVER (), MAX('2') FROM t1) +UNION ALL +(SELECT AVG(0) OVER (), MAX('2') FROM t1); +drop table t1; + +--echo # +--echo # MDEV-14791: Crash with order by expression containing window functions +--echo # + +CREATE TABLE t1 (b1 int, b2 int); +INSERT INTO t1 VALUES (1,1),(0,0); + +explain +SELECT b1 from t1 order by row_number() over (ORDER BY b2) + 1; + +SELECT b1 from t1 order by row_number() over (ORDER BY b2) + 1; + +explain +SELECT b1 from t1 order by row_number() over (ORDER BY b2); + +SELECT b1 from t1 order by row_number() over (ORDER BY b2); +DROP TABLE t1; + +CREATE TABLE t1 (a int, b int, c int); +INSERT INTO t1 VALUES (2,3,207), (1,21,909), (7,13,312), (8,64,248); + +explain +SELECT * FROM t1 ORDER BY max(t1.a) over (partition by c); +SELECT * FROM t1 ORDER BY max(t1.a) over (partition by c); + +explain +SELECT max(t1.a) over (partition by c) as x, b, c from t1 order by max(t1.a) over (partition by c); +SELECT max(t1.a) over (partition by c) as x, b, c from t1 order by max(t1.a) over (partition by c); + +drop table t1; + +--echo # +--echo # MDEV-18373: DENSE_RANK is not calculated correctly +--echo # + +create table t1 (a int, b int); +insert into t1 values (60, 1515),(60, 2000),(70, 2000),(55, 1600); + +select b, dense_rank() over (order by sum(a)) from t1 group by b; +select b, dense_rank() over (order by sum(a)+1) from t1 group by b; + +select b, row_number() over (partition by sum(a)) from t1 group by b; +select b, row_number() over (partition by sum(a)+1) from t1 group by b; + +drop table t1; + +--echo # --echo # End of 10.2 tests --echo # |