diff options
Diffstat (limited to 'mysql-test/main')
31 files changed, 603 insertions, 13 deletions
diff --git a/mysql-test/main/alter_table_errors.result b/mysql-test/main/alter_table_errors.result index 020a30304d0..b26409e3d05 100644 --- a/mysql-test/main/alter_table_errors.result +++ b/mysql-test/main/alter_table_errors.result @@ -8,3 +8,22 @@ t CREATE TABLE `t` ( `v` int(11) GENERATED ALWAYS AS (`a`) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 drop table t; +create temporary table t1 (a int, v int as (a)); +alter table t1 change column a b int, algorithm=inplace; +ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY +show create table t1; +Table Create Table +t1 CREATE TEMPORARY TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `v` int(11) GENERATED ALWAYS AS (`a`) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +create temporary table t2 (a int, v int as (a)); +lock table t2 write; +alter table t2 change column a b int, algorithm=inplace; +ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY +show create table t2; +Table Create Table +t2 CREATE TEMPORARY TABLE `t2` ( + `a` int(11) DEFAULT NULL, + `v` int(11) GENERATED ALWAYS AS (`a`) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 diff --git a/mysql-test/main/alter_table_errors.test b/mysql-test/main/alter_table_errors.test index d9982ac26f4..8fa65b0f330 100644 --- a/mysql-test/main/alter_table_errors.test +++ b/mysql-test/main/alter_table_errors.test @@ -8,3 +8,14 @@ create table t (a int, v int as (a)) engine=innodb; alter table t change column a b tinyint, algorithm=inplace; show create table t; drop table t; + +create temporary table t1 (a int, v int as (a)); +--error ER_ALTER_OPERATION_NOT_SUPPORTED +alter table t1 change column a b int, algorithm=inplace; +show create table t1; + +create temporary table t2 (a int, v int as (a)); +lock table t2 write; +--error ER_ALTER_OPERATION_NOT_SUPPORTED +alter table t2 change column a b int, algorithm=inplace; +show create table t2; diff --git a/mysql-test/main/check.result b/mysql-test/main/check.result index e3dcda773f4..e882a4cdbe6 100644 --- a/mysql-test/main/check.result +++ b/mysql-test/main/check.result @@ -85,3 +85,13 @@ t1 CREATE TABLE `t1` ( `c` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; +create temporary table t1 ( +id int not null auto_increment primary key, +f int not null default 0 +); +insert into t1 () values (); +alter ignore table t1 add constraint check (f > 0); +Warnings: +Warning 4025 CONSTRAINT `CONSTRAINT_1` failed for `test`.`t1` +alter table t1; +drop table t1; diff --git a/mysql-test/main/check.test b/mysql-test/main/check.test index cce8fd34c9c..475a7996a09 100644 --- a/mysql-test/main/check.test +++ b/mysql-test/main/check.test @@ -103,3 +103,15 @@ CREATE OR REPLACE TABLE t1 (a INT, b INT, c INT, CHECK (a+b>0)) ENGINE=MyISAM; ALTER TABLE t1 DROP COLUMN b, DROP CONSTRAINT `CONSTRAINT_1`; SHOW CREATE TABLE t1; DROP TABLE t1; + +# +# MDEV-16903 Assertion `!auto_increment_field_not_null' failed in TABLE::init after unsuccessful attempt to add CHECK constraint on temporary table +# +create temporary table t1 ( + id int not null auto_increment primary key, + f int not null default 0 +); +insert into t1 () values (); +alter ignore table t1 add constraint check (f > 0); +alter table t1; +drop table t1; diff --git a/mysql-test/main/func_group_innodb.result b/mysql-test/main/func_group_innodb.result index a2251f2b348..141d7ccff3a 100644 --- a/mysql-test/main/func_group_innodb.result +++ b/mysql-test/main/func_group_innodb.result @@ -246,4 +246,28 @@ EXPLAIN SELECT MIN(c) FROM t1 GROUP BY b; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range NULL b 263 NULL 2 Using index for group-by DROP TABLE t1; +# +# MDEV-17589: Stack-buffer-overflow with indexed varchar (utf8) field +# +CREATE TABLE t1 (v1 varchar(1020), v2 varchar(2), v3 varchar(2), +KEY k1 (v3,v2,v1)) ENGINE=InnoDB CHARACTER SET=utf8 ROW_FORMAT=DYNAMIC; +INSERT INTO t1 VALUES ('king', 'qu','qu'), ('bad','go','go'); +explain +SELECT MIN(t1.v1) FROM t1 where t1.v2='qu' and t1.v3='qu'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +SELECT MIN(t1.v1) FROM t1 where t1.v2='qu' and t1.v3='qu'; +MIN(t1.v1) +king +drop table t1; +CREATE TABLE t1 (v1 varchar(1024) CHARACTER SET utf8, KEY v1 (v1)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t1 VALUES ('king'), ('bad'); +explain +SELECT MIN(x.v1) FROM (SELECT t1.* FROM t1 WHERE t1.v1 >= 'p') x; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No matching min/max row +SELECT MIN(x.v1) FROM (SELECT t1.* FROM t1 WHERE t1.v1 >= 'p') x; +MIN(x.v1) +NULL +drop table t1; End of 5.5 tests diff --git a/mysql-test/main/func_group_innodb.test b/mysql-test/main/func_group_innodb.test index 1d175f85ed9..c4914b97641 100644 --- a/mysql-test/main/func_group_innodb.test +++ b/mysql-test/main/func_group_innodb.test @@ -192,4 +192,23 @@ EXPLAIN SELECT MIN(c) FROM t1 GROUP BY b; DROP TABLE t1; +--echo # +--echo # MDEV-17589: Stack-buffer-overflow with indexed varchar (utf8) field +--echo # + +CREATE TABLE t1 (v1 varchar(1020), v2 varchar(2), v3 varchar(2), + KEY k1 (v3,v2,v1)) ENGINE=InnoDB CHARACTER SET=utf8 ROW_FORMAT=DYNAMIC; +INSERT INTO t1 VALUES ('king', 'qu','qu'), ('bad','go','go'); +explain +SELECT MIN(t1.v1) FROM t1 where t1.v2='qu' and t1.v3='qu'; +SELECT MIN(t1.v1) FROM t1 where t1.v2='qu' and t1.v3='qu'; +drop table t1; + +CREATE TABLE t1 (v1 varchar(1024) CHARACTER SET utf8, KEY v1 (v1)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t1 VALUES ('king'), ('bad'); +explain +SELECT MIN(x.v1) FROM (SELECT t1.* FROM t1 WHERE t1.v1 >= 'p') x; +SELECT MIN(x.v1) FROM (SELECT t1.* FROM t1 WHERE t1.v1 >= 'p') x; +drop table t1; + --echo End of 5.5 tests diff --git a/mysql-test/main/func_hybrid_type.result b/mysql-test/main/func_hybrid_type.result index a86fd8d1d6f..129d49776a8 100644 --- a/mysql-test/main/func_hybrid_type.result +++ b/mysql-test/main/func_hybrid_type.result @@ -3753,6 +3753,24 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; # +# MDEV-17759 Assertion `precision > 0' failed in decimal_bin_size upon CREATE TABLE .. SELECT +# +SET sql_mode=''; +CREATE TABLE t1 (d DECIMAL(43,0) UNSIGNED); +INSERT INTO t1 VALUES (1); +CREATE TABLE t2 AS SELECT +IFNULL(SLEEP(0.01), NULL DIV d) AS f0, +IFNULL(SLEEP(0.01), '' DIV d) AS f1 +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `f0` decimal(1,0) DEFAULT NULL, + `f1` decimal(1,0) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1, t2; +SET sql_mode=DEFAULT; +# # End of 10.3 tests # # diff --git a/mysql-test/main/func_hybrid_type.test b/mysql-test/main/func_hybrid_type.test index 6b32f331d34..5281d846584 100644 --- a/mysql-test/main/func_hybrid_type.test +++ b/mysql-test/main/func_hybrid_type.test @@ -612,6 +612,22 @@ SHOW CREATE TABLE t1; DROP TABLE t1; --echo # +--echo # MDEV-17759 Assertion `precision > 0' failed in decimal_bin_size upon CREATE TABLE .. SELECT +--echo # + +SET sql_mode=''; +CREATE TABLE t1 (d DECIMAL(43,0) UNSIGNED); +INSERT INTO t1 VALUES (1); +CREATE TABLE t2 AS SELECT + IFNULL(SLEEP(0.01), NULL DIV d) AS f0, + IFNULL(SLEEP(0.01), '' DIV d) AS f1 +FROM t1; +SHOW CREATE TABLE t2; +DROP TABLE t1, t2; +SET sql_mode=DEFAULT; + + +--echo # --echo # End of 10.3 tests --echo # diff --git a/mysql-test/main/func_math.result b/mysql-test/main/func_math.result index 832ca69d3ea..eafee43e2a2 100644 --- a/mysql-test/main/func_math.result +++ b/mysql-test/main/func_math.result @@ -1285,3 +1285,36 @@ E59B9BE4BA94E585AD 2914501801 E4B883E585ABE4B99D 2374586519 DROP TABLE t1; SET NAMES default; +# +# MDEV-17759 Assertion `precision > 0' failed in decimal_bin_size upon CREATE TABLE .. SELECT +# +SET sql_mode=''; +CREATE TABLE t1 (d DECIMAL(43,0) UNSIGNED); +INSERT INTO t1 VALUES (1); +CREATE TABLE t2 AS SELECT +NULL DIV d AS d_null, +'' DIV d AS d_empty_string, +X'32' DIV d AS d_hex_string2, +X'3232' DIV d AS d_hex_string4, +TIME(0) DIV d AS d_time, +CURRENT_DATE DIV d AS d_date, +CURRENT_TIMESTAMP DIV d AS d_datetime +FROM t1; +Warnings: +Warning 1292 Truncated incorrect DECIMAL value: '' +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `d_null` int(1) unsigned DEFAULT NULL, + `d_empty_string` int(1) unsigned DEFAULT NULL, + `d_hex_string2` int(1) unsigned DEFAULT NULL, + `d_hex_string4` int(2) unsigned DEFAULT NULL, + `d_time` int(7) unsigned DEFAULT NULL, + `d_date` int(8) unsigned DEFAULT NULL, + `d_datetime` bigint(14) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1, t2; +SET sql_mode=DEFAULT; +# +# End of 10.3 tests +# diff --git a/mysql-test/main/func_math.test b/mysql-test/main/func_math.test index a2c54b58a67..bf95cfd7868 100644 --- a/mysql-test/main/func_math.test +++ b/mysql-test/main/func_math.test @@ -897,3 +897,28 @@ LOAD DATA INFILE '../../std_data/loaddata_utf8.dat' INTO TABLE t1 CHARACTER SET SELECT HEX(a), CRC32(a) from t1; DROP TABLE t1; SET NAMES default; + +--echo # +--echo # MDEV-17759 Assertion `precision > 0' failed in decimal_bin_size upon CREATE TABLE .. SELECT +--echo # + +SET sql_mode=''; +CREATE TABLE t1 (d DECIMAL(43,0) UNSIGNED); +INSERT INTO t1 VALUES (1); +CREATE TABLE t2 AS SELECT + NULL DIV d AS d_null, + '' DIV d AS d_empty_string, + X'32' DIV d AS d_hex_string2, + X'3232' DIV d AS d_hex_string4, + TIME(0) DIV d AS d_time, + CURRENT_DATE DIV d AS d_date, + CURRENT_TIMESTAMP DIV d AS d_datetime +FROM t1; +SHOW CREATE TABLE t2; +DROP TABLE t1, t2; +SET sql_mode=DEFAULT; + + +--echo # +--echo # End of 10.3 tests +--echo # diff --git a/mysql-test/main/grant5.result b/mysql-test/main/grant5.result index 5df4a669a0c..5bf7b2d1934 100644 --- a/mysql-test/main/grant5.result +++ b/mysql-test/main/grant5.result @@ -18,6 +18,13 @@ ERROR 42000: Access denied for user 'test'@'%' to database 'mysql' connection default; drop user test, foo; drop role foo; +CREATE TABLE t1 (a INT); +LOCK TABLE t1 WRITE; +REVOKE EXECUTE ON PROCEDURE sp FROM u; +ERROR HY000: Table 'procs_priv' was not locked with LOCK TABLES +REVOKE PROCESS ON *.* FROM u; +ERROR HY000: Table 'db' was not locked with LOCK TABLES +DROP TABLE t1; create user u1@h identified with 'mysql_native_password' using 'pwd'; ERROR HY000: Password hash should be a 41-digit hexadecimal number create user u1@h identified with 'mysql_native_password' using password('pwd'); diff --git a/mysql-test/main/grant5.test b/mysql-test/main/grant5.test index 4e89bad9775..daf972dbe4b 100644 --- a/mysql-test/main/grant5.test +++ b/mysql-test/main/grant5.test @@ -24,6 +24,17 @@ drop user test, foo; drop role foo; # +# MDEV-17975 Assertion `! is_set()' or `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())' failed upon REVOKE under LOCK TABLE +# +CREATE TABLE t1 (a INT); +LOCK TABLE t1 WRITE; +--error ER_TABLE_NOT_LOCKED +REVOKE EXECUTE ON PROCEDURE sp FROM u; +--error ER_TABLE_NOT_LOCKED +REVOKE PROCESS ON *.* FROM u; +DROP TABLE t1; + +# # MDEV-12321 authentication plugin: SET PASSWORD support # error ER_PASSWD_LENGTH; diff --git a/mysql-test/main/innodb_ext_key.result b/mysql-test/main/innodb_ext_key.result index f9210bd168c..db08d1148b8 100644 --- a/mysql-test/main/innodb_ext_key.result +++ b/mysql-test/main/innodb_ext_key.result @@ -1091,6 +1091,7 @@ from t0 A, t0 B, t0 C; drop table t0,t1; # +# # MDEV-10360: Extended keys: index properties depend on index order # create table t0 (a int); diff --git a/mysql-test/main/innodb_ext_key.test b/mysql-test/main/innodb_ext_key.test index a721943e8bc..4104ac5f787 100644 --- a/mysql-test/main/innodb_ext_key.test +++ b/mysql-test/main/innodb_ext_key.test @@ -726,6 +726,7 @@ if ($rows < 2) drop table t0,t1; --echo # +--echo # --echo # MDEV-10360: Extended keys: index properties depend on index order --echo # create table t0 (a int); diff --git a/mysql-test/main/mysqldump.result b/mysql-test/main/mysqldump.result index 1a3b927f981..c40aa271465 100644 --- a/mysql-test/main/mysqldump.result +++ b/mysql-test/main/mysqldump.result @@ -4335,12 +4335,12 @@ second ee1 root@localhost UTC ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL E 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 '2018-12-31 21:01:23' do set @a=5; +create event ee2 on schedule at '2030-12-31 21:01:22' do set @a=5; create event ee3 on schedule at '2030-12-31 22:01:23' do set @a=5; 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 -second ee2 root@localhost UTC ONE TIME 2018-12-31 21:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci +second ee2 root@localhost UTC ONE TIME 2030-12-31 21:01:22 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci second ee3 root@localhost UTC ONE TIME 2030-12-31 22:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci drop database second; create database third; @@ -4348,7 +4348,7 @@ use third; 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 third 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 -third ee2 root@localhost UTC ONE TIME 2018-12-31 21:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci +third ee2 root@localhost UTC ONE TIME 2030-12-31 21:01:22 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci third ee3 root@localhost UTC ONE TIME 2030-12-31 22:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci drop database third; set time_zone = 'SYSTEM'; diff --git a/mysql-test/main/mysqldump.test b/mysql-test/main/mysqldump.test index 57462fcf2e2..e2d9cc74d32 100644 --- a/mysql-test/main/mysqldump.test +++ b/mysql-test/main/mysqldump.test @@ -1810,7 +1810,7 @@ show create event ee1; ## prove three works (with spaces and tabs on the end) # start with one from the previous restore -create event ee2 on schedule at '2018-12-31 21:01:23' do set @a=5; +create event ee2 on schedule at '2030-12-31 21:01:22' do set @a=5; create event ee3 on schedule at '2030-12-31 22:01:23' do set @a=5; show events; --exec $MYSQL_DUMP --events second > $MYSQLTEST_VARDIR/tmp/bug16853-2.sql diff --git a/mysql-test/main/partition_alter.test b/mysql-test/main/partition_alter.test index 62a3e1c0777..91ae67e2f7b 100644 --- a/mysql-test/main/partition_alter.test +++ b/mysql-test/main/partition_alter.test @@ -79,7 +79,6 @@ partition p1 values less than ('2016-10-18'), partition p2 values less than ('2020-10-19')); insert t1 values (0, '2000-01-02', 0); insert t1 values (1, '2020-01-02', 10); ---replace_regex /#sql-[0-9a-f_]*/#sql-temporary/ --error ER_CONSTRAINT_FAILED alter table t1 add check (b in (0, 1)); alter table t1 add check (b in (0, 10)); @@ -96,7 +95,6 @@ partition p1 values less than ('2016-10-18'), partition p2 values less than ('2020-10-19')); insert t1 values (0, '2000-01-02', 0); insert t1 values (1, '2020-01-02', 10); ---replace_regex /#sql-[0-9a-f_]*/#sql-temporary/ --error ER_CONSTRAINT_FAILED alter table t1 add check (b in (0, 1)); alter table t1 add check (b in (0, 10)); diff --git a/mysql-test/main/partition_innodb.result b/mysql-test/main/partition_innodb.result index 7d26e5fe216..e91d3767fcc 100644 --- a/mysql-test/main/partition_innodb.result +++ b/mysql-test/main/partition_innodb.result @@ -955,6 +955,26 @@ test_jfg test_jfg11 test_jfg test_jfg12#P#p1000 test_jfg test_jfg12#P#pmax DROP DATABASE test_jfg; +create table t1 (a int) engine=innodb; +create table t2 ( +b int, +c int, +d bit not null default 0, +v bit as (d) virtual, +key (b,v) +) engine=innodb partition by hash (b); +insert into t1 values (1),(2); +insert into t2 (b,c,d) values (1,1,0),(2,2,0); +explain select t1.* from t1 join t2 on (v = a); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 +1 SIMPLE t2 index NULL b 7 NULL 2 Using where; Using index; Using join buffer (flat, BNL join) +select t1.* from t1 join t2 on (v = a); +a +drop table t1, t2; +# +# End of 10.2 tests +# # # MDEV-16241 Assertion `inited==RND' failed in handler::ha_rnd_end() # @@ -966,3 +986,6 @@ SELECT COUNT(*) FROM t1 WHERE x IS NULL AND y IS NULL AND z IS NULL; COUNT(*) 2 DROP TABLE t1; +# +# End of 10.3 tests +# diff --git a/mysql-test/main/partition_innodb.test b/mysql-test/main/partition_innodb.test index 4b4662da47b..57d644d293d 100644 --- a/mysql-test/main/partition_innodb.test +++ b/mysql-test/main/partition_innodb.test @@ -1048,6 +1048,27 @@ database_name = 'test_jfg'; DROP DATABASE test_jfg; +# +# MDEV-17755 Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index) || (!(ptr >= table->record[0] && ptr < table->record[0] + table->s->reclength)))' failed in Field_bit::val_int upon SELECT with JOIN, partitions, indexed virtual column +# +create table t1 (a int) engine=innodb; +create table t2 ( + b int, + c int, + d bit not null default 0, + v bit as (d) virtual, + key (b,v) +) engine=innodb partition by hash (b); +insert into t1 values (1),(2); +insert into t2 (b,c,d) values (1,1,0),(2,2,0); +explain select t1.* from t1 join t2 on (v = a); +select t1.* from t1 join t2 on (v = a); +drop table t1, t2; + +--echo # +--echo # End of 10.2 tests +--echo # + --echo # --echo # MDEV-16241 Assertion `inited==RND' failed in handler::ha_rnd_end() --echo # @@ -1057,3 +1078,7 @@ PARTITION BY SYSTEM_TIME (PARTITION p1 HISTORY, PARTITION pn CURRENT); INSERT INTO t1 VALUES (1, 7, 8, 9), (2, NULL, NULL, NULL), (3, NULL, NULL, NULL); SELECT COUNT(*) FROM t1 WHERE x IS NULL AND y IS NULL AND z IS NULL; DROP TABLE t1; + +--echo # +--echo # End of 10.3 tests +--echo # diff --git a/mysql-test/main/ps_error.result b/mysql-test/main/ps_error.result new file mode 100644 index 00000000000..c3c312e82f5 --- /dev/null +++ b/mysql-test/main/ps_error.result @@ -0,0 +1,73 @@ +# +# MDEV-17741 Assertion `thd->Item_change_list::is_empty()' failed in mysql_parse after unsuccessful PS +# +SET SQL_MODE= 'STRICT_ALL_TABLES'; +CREATE TABLE t1 (a INT); +PREPARE stmt FROM "CREATE TABLE tmp AS SELECT * FROM t1 WHERE 'foo' && 0"; +Warnings: +Warning 1292 Truncated incorrect INTEGER value: 'foo' +EXECUTE stmt; +ERROR 22007: Truncated incorrect INTEGER value: 'foo' +SELECT a FROM t1 GROUP BY NULL WITH ROLLUP; +a +DROP TABLE t1; +SET sql_mode=DEFAULT; +SET SQL_MODE= 'STRICT_ALL_TABLES'; +CREATE TABLE t1 (a INT); +PREPARE stmt FROM "CREATE TABLE tmp AS SELECT * FROM t1 WHERE 'foo' && 0"; +Warnings: +Warning 1292 Truncated incorrect INTEGER value: 'foo' +EXECUTE stmt; +ERROR 22007: Truncated incorrect INTEGER value: 'foo' +SET @a = REPLACE( @@global.optimizer_switch, '=on', '=off' ) ; +DROP TABLE t1; +SET sql_mode=DEFAULT; +# +# MDEV-17738 Server crashes in Item::delete_self on closing connection after unsuccessful PS +# +SET SQL_MODE='STRICT_ALL_TABLES'; +PREPARE stmt FROM "CREATE TABLE ps AS SELECT 1 FROM DUAL WHERE 'foo' && 0"; +Warnings: +Warning 1292 Truncated incorrect INTEGER value: 'foo' +EXECUTE stmt; +ERROR 22007: Truncated incorrect INTEGER value: 'foo' +SELECT 'All done'; +All done +All done +SET SQL_MODE=DEFAULT; +SET SQL_MODE='STRICT_ALL_TABLES'; +PREPARE stmt FROM "CREATE TABLE ps AS SELECT 1 FROM DUAL WHERE 'foo' && 0"; +Warnings: +Warning 1292 Truncated incorrect INTEGER value: 'foo' +EXECUTE stmt; +ERROR 22007: Truncated incorrect INTEGER value: 'foo' +DEALLOCATE PREPARE stmt; +SELECT 'All done'; +All done +All done +SET SQL_MODE=DEFAULT; +SET SQL_MODE= 'STRICT_ALL_TABLES'; +CREATE TABLE t1 (a INT); +PREPARE stmt FROM "CREATE TABLE tmp AS SELECT * FROM t1 WHERE 'foo' && 0"; +Warnings: +Warning 1292 Truncated incorrect INTEGER value: 'foo' +EXECUTE stmt; +ERROR 22007: Truncated incorrect INTEGER value: 'foo' +SELECT a FROM t1 GROUP BY a; +a +SELECT * FROM t1; +a +DROP TABLE t1; +SET SQL_MODE=DEFAULT; +SET SQL_MODE= 'STRICT_ALL_TABLES'; +CREATE TABLE t1 (a INT); +PREPARE stmt FROM "CREATE TABLE tmp AS SELECT * FROM t1 WHERE 'foo' && 0"; +Warnings: +Warning 1292 Truncated incorrect INTEGER value: 'foo' +EXECUTE stmt; +ERROR 22007: Truncated incorrect INTEGER value: 'foo' +SELECT a FROM t1 GROUP BY a; +a +INSERT t1 SELECT * FROM ( SELECT * FROM t1 ) sq; +DROP TABLE t1; +SET SQL_MODE=DEFAULT; diff --git a/mysql-test/main/ps_error.test b/mysql-test/main/ps_error.test new file mode 100644 index 00000000000..5efb5d36137 --- /dev/null +++ b/mysql-test/main/ps_error.test @@ -0,0 +1,66 @@ +# +# Tests related to PS returning errors rather than doing successfull execution +# + +--echo # +--echo # MDEV-17741 Assertion `thd->Item_change_list::is_empty()' failed in mysql_parse after unsuccessful PS +--echo # + +SET SQL_MODE= 'STRICT_ALL_TABLES'; +CREATE TABLE t1 (a INT); +PREPARE stmt FROM "CREATE TABLE tmp AS SELECT * FROM t1 WHERE 'foo' && 0"; +--error ER_TRUNCATED_WRONG_VALUE +EXECUTE stmt; +SELECT a FROM t1 GROUP BY NULL WITH ROLLUP; +DROP TABLE t1; +SET sql_mode=DEFAULT; + +SET SQL_MODE= 'STRICT_ALL_TABLES'; +CREATE TABLE t1 (a INT); +PREPARE stmt FROM "CREATE TABLE tmp AS SELECT * FROM t1 WHERE 'foo' && 0"; +--error ER_TRUNCATED_WRONG_VALUE +EXECUTE stmt; +SET @a = REPLACE( @@global.optimizer_switch, '=on', '=off' ) ; +DROP TABLE t1; +SET sql_mode=DEFAULT; + + +--echo # +--echo # MDEV-17738 Server crashes in Item::delete_self on closing connection after unsuccessful PS +--echo # + +SET SQL_MODE='STRICT_ALL_TABLES'; +PREPARE stmt FROM "CREATE TABLE ps AS SELECT 1 FROM DUAL WHERE 'foo' && 0"; +--error ER_TRUNCATED_WRONG_VALUE +EXECUTE stmt; +--source include/restart_mysqld.inc +SELECT 'All done'; +SET SQL_MODE=DEFAULT; + +SET SQL_MODE='STRICT_ALL_TABLES'; +PREPARE stmt FROM "CREATE TABLE ps AS SELECT 1 FROM DUAL WHERE 'foo' && 0"; +--error ER_TRUNCATED_WRONG_VALUE +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +SELECT 'All done'; +SET SQL_MODE=DEFAULT; + +SET SQL_MODE= 'STRICT_ALL_TABLES'; +CREATE TABLE t1 (a INT); +PREPARE stmt FROM "CREATE TABLE tmp AS SELECT * FROM t1 WHERE 'foo' && 0"; +--error ER_TRUNCATED_WRONG_VALUE +EXECUTE stmt; +SELECT a FROM t1 GROUP BY a; +SELECT * FROM t1; +DROP TABLE t1; +SET SQL_MODE=DEFAULT; + +SET SQL_MODE= 'STRICT_ALL_TABLES'; +CREATE TABLE t1 (a INT); +PREPARE stmt FROM "CREATE TABLE tmp AS SELECT * FROM t1 WHERE 'foo' && 0"; +--error ER_TRUNCATED_WRONG_VALUE +EXECUTE stmt; +SELECT a FROM t1 GROUP BY a; +INSERT t1 SELECT * FROM ( SELECT * FROM t1 ) sq; +DROP TABLE t1; +SET SQL_MODE=DEFAULT; diff --git a/mysql-test/main/range_innodb.result b/mysql-test/main/range_innodb.result index 2ede6351957..ae25adf1a19 100644 --- a/mysql-test/main/range_innodb.result +++ b/mysql-test/main/range_innodb.result @@ -38,3 +38,21 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t0 ALL NULL NULL NULL NULL 10 1 SIMPLE t2 range a,b b 5 NULL 201 Using where; Using join buffer (flat, BNL join) drop table t0,t1,t2; +CREATE TABLE t1 ( +pk INT PRIMARY KEY, f1 INT, f2 CHAR(1), f3 CHAR(1), +KEY(f1), KEY(f2) +) ENGINE=InnoDB; +INSERT INTO t1 VALUES +(1,4,'v',NULL),(2,6,'v',NULL),(3,7,'c',NULL),(4,1,'e',NULL),(5,0,'x',NULL), +(6,7,'i',NULL),(7,7,'e',NULL),(8,1,'p',NULL),(9,7,'s',NULL),(10,1,'j',NULL), +(11,5,'z',NULL),(12,2,'c',NULL),(13,0,'a',NULL),(14,1,'q',NULL),(15,8,'y',NULL), +(16,1,'m',NULL),(17,1,'r',NULL),(18,9,'v',NULL),(19,1,'n',NULL); +CREATE TABLE t2 (f4 INT, f5 CHAR(1)) ENGINE=InnoDB; +INSERT INTO t2 VALUES (4,'q'),(NULL,'j'); +SELECT * FROM t1 AS t1_1, t1 AS t1_2, t2 +WHERE f5 = t1_2.f2 AND ( t1_1.f1 = 103 AND t1_1.f2 = 'o' OR t1_1.pk < f4 ); +pk f1 f2 f3 pk f1 f2 f3 f4 f5 +1 4 v NULL 14 1 q NULL 4 q +2 6 v NULL 14 1 q NULL 4 q +3 7 c NULL 14 1 q NULL 4 q +drop table t1,t2; diff --git a/mysql-test/main/range_innodb.test b/mysql-test/main/range_innodb.test index f76794814ef..605006587cc 100644 --- a/mysql-test/main/range_innodb.test +++ b/mysql-test/main/range_innodb.test @@ -45,3 +45,20 @@ explain select * from t0 left join t2 on t2.a <t0.a and t2.b between 50 and 250; drop table t0,t1,t2; +CREATE TABLE t1 ( + pk INT PRIMARY KEY, f1 INT, f2 CHAR(1), f3 CHAR(1), + KEY(f1), KEY(f2) +) ENGINE=InnoDB; + +INSERT INTO t1 VALUES +(1,4,'v',NULL),(2,6,'v',NULL),(3,7,'c',NULL),(4,1,'e',NULL),(5,0,'x',NULL), +(6,7,'i',NULL),(7,7,'e',NULL),(8,1,'p',NULL),(9,7,'s',NULL),(10,1,'j',NULL), +(11,5,'z',NULL),(12,2,'c',NULL),(13,0,'a',NULL),(14,1,'q',NULL),(15,8,'y',NULL), +(16,1,'m',NULL),(17,1,'r',NULL),(18,9,'v',NULL),(19,1,'n',NULL); + +CREATE TABLE t2 (f4 INT, f5 CHAR(1)) ENGINE=InnoDB; +INSERT INTO t2 VALUES (4,'q'),(NULL,'j'); + +SELECT * FROM t1 AS t1_1, t1 AS t1_2, t2 +WHERE f5 = t1_2.f2 AND ( t1_1.f1 = 103 AND t1_1.f2 = 'o' OR t1_1.pk < f4 ); +drop table t1,t2; diff --git a/mysql-test/main/read_only.result b/mysql-test/main/read_only.result index 2029413c0f0..83dfada5f29 100644 --- a/mysql-test/main/read_only.result +++ b/mysql-test/main/read_only.result @@ -170,11 +170,24 @@ flush privileges; drop database mysqltest_db1; set global read_only= @start_read_only; # +# MDEV-16987 - ALTER DATABASE possible in read-only mode +# +CREATE USER user1@localhost; +GRANT ALTER ON test1.* TO user1@localhost; +CREATE DATABASE test1; +SET GLOBAL read_only=1; +ALTER DATABASE test1 CHARACTER SET utf8; +ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement +SET GLOBAL read_only=0; +DROP DATABASE test1; +DROP USER user1@localhost; +USE test; +# End of 5.5 tests +# # WL#5968 Implement START TRANSACTION READ (WRITE|ONLY); # # # Test interaction with read_only system variable. -DROP TABLE IF EXISTS t1; CREATE TABLE t1(a INT); INSERT INTO t1 VALUES (1), (2); CREATE USER user1; @@ -211,3 +224,4 @@ connection default; DROP USER user1; SET GLOBAL read_only= 0; DROP TABLE t1; +# End of 10.0 tests diff --git a/mysql-test/main/read_only.test b/mysql-test/main/read_only.test index a05f813346e..5314b11154f 100644 --- a/mysql-test/main/read_only.test +++ b/mysql-test/main/read_only.test @@ -283,6 +283,23 @@ flush privileges; drop database mysqltest_db1; set global read_only= @start_read_only; +--echo # +--echo # MDEV-16987 - ALTER DATABASE possible in read-only mode +--echo # +CREATE USER user1@localhost; +GRANT ALTER ON test1.* TO user1@localhost; +CREATE DATABASE test1; +SET GLOBAL read_only=1; +change_user user1; +--error ER_OPTION_PREVENTS_STATEMENT +ALTER DATABASE test1 CHARACTER SET utf8; +change_user root; +SET GLOBAL read_only=0; +DROP DATABASE test1; +DROP USER user1@localhost; +USE test; + +--echo # End of 5.5 tests --echo # --echo # WL#5968 Implement START TRANSACTION READ (WRITE|ONLY); @@ -291,10 +308,6 @@ set global read_only= @start_read_only; --echo # --echo # Test interaction with read_only system variable. ---disable_warnings -DROP TABLE IF EXISTS t1; ---enable_warnings - CREATE TABLE t1(a INT); INSERT INTO t1 VALUES (1), (2); @@ -344,3 +357,5 @@ DROP TABLE t1; # Wait till all disconnects are completed --source include/wait_until_count_sessions.inc + +--echo # End of 10.0 tests diff --git a/mysql-test/main/sp.result b/mysql-test/main/sp.result index b110ab670ae..39bc09e21d6 100644 --- a/mysql-test/main/sp.result +++ b/mysql-test/main/sp.result @@ -8708,3 +8708,38 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; DROP FUNCTION f1; +# +# MDEV-16036: Debug assertion failed in resignal on create +# temporary table +# +set @save_sql_mode= @@sql_mode; +set sql_mode='ORACLE'; +CREATE or replace procedure p4() +AS +CONTINUE HANDLER FOR SQLWARNING +BEGIN +NULL; +END; +EXIT HANDLER FOR OTHERS -- SQLEXCEPTION +BEGIN +GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE, @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT; +SELECT @sqlstate, @errno, @text; +SHOW WARNINGS; +RESIGNAL; -- cause DBG_ASSERT failed +END; +BEGIN +CREATE TEMPORARY TABLE IF NOT EXISTS t1(origine VARCHAR2(10) NOT NULL); +END +/ +call p4(); +call p4(); +@sqlstate @errno @text +42S01 1050 Table 't1' already exists +Level Code Message +Note 1050 Table 't1' already exists +Warnings: +Note 1050 Table 't1' already exists +drop procedure p4; +drop table t1; +set @@sql_mode=@save_sql_mode; +# End of 10.3 tests diff --git a/mysql-test/main/sp.test b/mysql-test/main/sp.test index 721855895c7..230e9c8bb18 100644 --- a/mysql-test/main/sp.test +++ b/mysql-test/main/sp.test @@ -10239,3 +10239,37 @@ CREATE TABLE t1 AS SELECT f1() AS c1, COALESCE(f1()) AS c2, CONCAT(f1()) AS c3; SHOW CREATE TABLE t1; DROP TABLE t1; DROP FUNCTION f1; + +--echo # +--echo # MDEV-16036: Debug assertion failed in resignal on create +--echo # temporary table +--echo # + +set @save_sql_mode= @@sql_mode; +set sql_mode='ORACLE'; +delimiter /; +CREATE or replace procedure p4() +AS + CONTINUE HANDLER FOR SQLWARNING + BEGIN + NULL; + END; + EXIT HANDLER FOR OTHERS -- SQLEXCEPTION + BEGIN + GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE, @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT; + SELECT @sqlstate, @errno, @text; + SHOW WARNINGS; + RESIGNAL; -- cause DBG_ASSERT failed + END; +BEGIN + CREATE TEMPORARY TABLE IF NOT EXISTS t1(origine VARCHAR2(10) NOT NULL); +END +/ +delimiter ;/ +call p4(); +call p4(); +drop procedure p4; +drop table t1; +set @@sql_mode=@save_sql_mode; + +--echo # End of 10.3 tests diff --git a/mysql-test/main/udf.result b/mysql-test/main/udf.result index 13eb186135b..6655982a38f 100644 --- a/mysql-test/main/udf.result +++ b/mysql-test/main/udf.result @@ -465,6 +465,20 @@ a b Hello HL DROP FUNCTION METAPHON; DROP TABLE t1; +# +# MDEV-15424: Unreasonal SQL Error (1356) on select from view +# +CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB"; +create table t1(a int , b int); +insert into t1 values(100, 54), (200, 199); +create view v1 as select myfunc_int(max(a) over (order by b) , b) from t1; +select * from v1; +myfunc_int(max(a) over (order by b) , b) +154 +399 +drop view v1; +drop function myfunc_int; +drop table t1; MDEV-15073: Generic UDAF parser code in server for windows functions diff --git a/mysql-test/main/udf.test b/mysql-test/main/udf.test index 43d66dc68e2..bb8493135aa 100644 --- a/mysql-test/main/udf.test +++ b/mysql-test/main/udf.test @@ -529,6 +529,19 @@ DROP FUNCTION METAPHON; #SELECT * FROM t1; DROP TABLE t1; +--echo # +--echo # MDEV-15424: Unreasonal SQL Error (1356) on select from view +--echo # +--replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB +eval CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "$UDF_EXAMPLE_SO"; +create table t1(a int , b int); +insert into t1 values(100, 54), (200, 199); +create view v1 as select myfunc_int(max(a) over (order by b) , b) from t1; +select * from v1; +drop view v1; +drop function myfunc_int; +drop table t1; + --echo --echo MDEV-15073: Generic UDAF parser code in server for windows functions --echo diff --git a/mysql-test/main/win.result b/mysql-test/main/win.result index ce8c1311222..279404968bf 100644 --- a/mysql-test/main/win.result +++ b/mysql-test/main/win.result @@ -3471,7 +3471,25 @@ MIN(b1) OVER () 1 drop table t1; # -# Start of 10.3 tests +# MDEV-15424: Unreasonal SQL Error (1356) on select from view +# +create table t1 (id int, n1 int); +insert into t1 values (1,1), (2,1), (3,2), (4,4); +create view v1 as SELECT ifnull(max(n1) over (partition by n1),'aaa') FROM t1; +explain select * from v1; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4 +2 DERIVED t1 ALL NULL NULL NULL NULL 4 Using temporary +select * from v1; +ifnull(max(n1) over (partition by n1),'aaa') +1 +1 +2 +4 +drop table t1; +drop view v1; +# +# End of 10.2 tests # # # MDEV-16489 when lead() returns null on a datetime field, the result is treated as the literal string '[NULL]' @@ -3491,6 +3509,9 @@ d x 00:00:02 NULL DROP TABLE t1; # +# End of 10.3 tests +# +# # MDEV-16722: Assertion `type() != NULL_ITEM' failed # create table t1 (a int); diff --git a/mysql-test/main/win.test b/mysql-test/main/win.test index 0254667579a..19e83ea8c41 100644 --- a/mysql-test/main/win.test +++ b/mysql-test/main/win.test @@ -2229,7 +2229,20 @@ SELECT DISTINCT MIN(b1) OVER () FROM t1; drop table t1; --echo # ---echo # Start of 10.3 tests +--echo # MDEV-15424: Unreasonal SQL Error (1356) on select from view +--echo # + +create table t1 (id int, n1 int); +insert into t1 values (1,1), (2,1), (3,2), (4,4); + +create view v1 as SELECT ifnull(max(n1) over (partition by n1),'aaa') FROM t1; +explain select * from v1; +select * from v1; +drop table t1; +drop view v1; + +--echo # +--echo # End of 10.2 tests --echo # --echo # @@ -2247,6 +2260,10 @@ SELECT *, LEAD(d) OVER (ORDER BY d) AS x FROM t1; DROP TABLE t1; --echo # +--echo # End of 10.3 tests +--echo # + +--echo # --echo # MDEV-16722: Assertion `type() != NULL_ITEM' failed --echo # |