diff options
author | Sergei Golubchik <serg@mariadb.org> | 2019-01-03 13:09:41 +0100 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2019-01-03 13:09:41 +0100 |
commit | 6bb11efa4a7ba813eb4aa2548f95b7297d70f3d7 (patch) | |
tree | 3c2dfb2dfbbb0a2471bdcfb0f0c122f823cc80ab /mysql-test/main | |
parent | ab4bc8442094a2be8cdb74bfcddfccede81ac03d (diff) | |
parent | 842402e4df35c230e7a416ce3ef8df3055f03d60 (diff) | |
download | mariadb-git-6bb11efa4a7ba813eb4aa2548f95b7297d70f3d7.tar.gz |
Merge branch '10.2' into 10.3
Diffstat (limited to 'mysql-test/main')
23 files changed, 302 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 27493ae710b..e149997af4f 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 3 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/grant5.result b/mysql-test/main/grant5.result index 24abc61a348..c0fecf0c369 100644 --- a/mysql-test/main/grant5.result +++ b/mysql-test/main/grant5.result @@ -18,3 +18,10 @@ 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 'user' was not locked with LOCK TABLES +REVOKE PROCESS ON *.* FROM u; +ERROR HY000: Table 'user' was not locked with LOCK TABLES +DROP TABLE t1; diff --git a/mysql-test/main/grant5.test b/mysql-test/main/grant5.test index 14f2fd65020..649bba7d1ca 100644 --- a/mysql-test/main/grant5.test +++ b/mysql-test/main/grant5.test @@ -23,3 +23,13 @@ show grants for foo@'%'; # user 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; diff --git a/mysql-test/main/innodb_ext_key.result b/mysql-test/main/innodb_ext_key.result index c55e8d138f8..7a994730738 100644 --- a/mysql-test/main/innodb_ext_key.result +++ b/mysql-test/main/innodb_ext_key.result @@ -1089,6 +1089,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 1366f9bdd12..556245df9cd 100644 --- a/mysql-test/main/mysqldump.result +++ b/mysql-test/main/mysqldump.result @@ -4333,12 +4333,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; @@ -4346,7 +4346,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 6567596c35c..dbd32f3e74a 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 3d8d2040a48..cdfe619cb29 100644 --- a/mysql-test/main/partition_innodb.result +++ b/mysql-test/main/partition_innodb.result @@ -954,6 +954,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() # @@ -965,3 +985,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/range_innodb.result b/mysql-test/main/range_innodb.result index 794e6c7b3cc..8bb1c833a56 100644 --- a/mysql-test/main/range_innodb.result +++ b/mysql-test/main/range_innodb.result @@ -37,3 +37,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/udf.result b/mysql-test/main/udf.result index 6af6b167511..edbae7e046f 100644 --- a/mysql-test/main/udf.result +++ b/mysql-test/main/udf.result @@ -465,3 +465,17 @@ 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; diff --git a/mysql-test/main/udf.test b/mysql-test/main/udf.test index c3a25c6bcce..d2c0dad8398 100644 --- a/mysql-test/main/udf.test +++ b/mysql-test/main/udf.test @@ -528,3 +528,16 @@ DROP FUNCTION METAPHON; #INSERT INTO t1 (a) VALUES ('Hello'); #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; diff --git a/mysql-test/main/win.result b/mysql-test/main/win.result index 6ee6f01ba8d..73f9c65b41f 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]' @@ -3490,3 +3508,6 @@ d x 00:00:01 00:00:02 00:00:02 NULL DROP TABLE t1; +# +# End of 10.3 tests +# diff --git a/mysql-test/main/win.test b/mysql-test/main/win.test index 1b49ac681f4..15e96ec7e8e 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 # @@ -2245,3 +2258,7 @@ CREATE TABLE t1 (d time); INSERT INTO t1 VALUES ('00:00:01'),('00:00:02'); SELECT *, LEAD(d) OVER (ORDER BY d) AS x FROM t1; DROP TABLE t1; + +--echo # +--echo # End of 10.3 tests +--echo # |