summaryrefslogtreecommitdiff
path: root/mysql-test/main
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2019-05-05 15:03:48 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2019-05-05 15:06:44 +0300
commitd3dcec5d657b83ca08b32f5a64b5dff01edfb13e (patch)
tree5fd801aa0daf5e74689b17ed50a086a8acd7d6e7 /mysql-test/main
parentb132b8895e2e59df457e063451f186b53576b034 (diff)
parente8dd18a474ee6b48eb7f92e3831f9e359b0bdc6e (diff)
downloadmariadb-git-d3dcec5d657b83ca08b32f5a64b5dff01edfb13e.tar.gz
Merge 10.3 into 10.4
Diffstat (limited to 'mysql-test/main')
-rw-r--r--mysql-test/main/cast.result6
-rw-r--r--mysql-test/main/cast.test6
-rw-r--r--mysql-test/main/constraints.result20
-rw-r--r--mysql-test/main/constraints.test23
-rw-r--r--mysql-test/main/cte_nonrecursive.result8
-rw-r--r--mysql-test/main/derived.result54
-rw-r--r--mysql-test/main/derived.test30
-rw-r--r--mysql-test/main/derived_view.result2
-rw-r--r--mysql-test/main/events_grant.result2
-rw-r--r--mysql-test/main/func_gconcat.result14
-rw-r--r--mysql-test/main/func_gconcat.test12
-rw-r--r--mysql-test/main/grant.result10
-rw-r--r--mysql-test/main/information_schema.result2
-rw-r--r--mysql-test/main/join_cache.result6
-rw-r--r--mysql-test/main/subselect_extra.result2
-rw-r--r--mysql-test/main/subselect_extra_no_semijoin.result2
-rw-r--r--mysql-test/main/trigger.result32
-rw-r--r--mysql-test/main/trigger.test34
18 files changed, 230 insertions, 35 deletions
diff --git a/mysql-test/main/cast.result b/mysql-test/main/cast.result
index f1e7eb7b502..17329cb596f 100644
--- a/mysql-test/main/cast.result
+++ b/mysql-test/main/cast.result
@@ -1277,3 +1277,9 @@ END;
$$
ERROR 22007: Truncated incorrect CHAR(1) value: '10:20:30'
SET sql_mode=DEFAULT;
+#
+# MDEV-10307 CAST(11068046444225730969 AS SIGNED) does not return a warning
+#
+SELECT CAST(11068046444225730969 AS SIGNED);
+CAST(11068046444225730969 AS SIGNED)
+-7378697629483820647
diff --git a/mysql-test/main/cast.test b/mysql-test/main/cast.test
index b514dbb5b2d..f48d6d9f95f 100644
--- a/mysql-test/main/cast.test
+++ b/mysql-test/main/cast.test
@@ -724,3 +724,9 @@ $$
DELIMITER ;$$
SET sql_mode=DEFAULT;
+
+--echo #
+--echo # MDEV-10307 CAST(11068046444225730969 AS SIGNED) does not return a warning
+--echo #
+
+SELECT CAST(11068046444225730969 AS SIGNED);
diff --git a/mysql-test/main/constraints.result b/mysql-test/main/constraints.result
index aba226cdd33..0b7577dd3ac 100644
--- a/mysql-test/main/constraints.result
+++ b/mysql-test/main/constraints.result
@@ -1,4 +1,3 @@
-drop table if exists t1;
create table t1 (a int check (a>0));
show create table t1;
Table Create Table
@@ -111,6 +110,25 @@ long_enough_name CREATE TABLE `long_enough_name` (
CONSTRAINT `constr` CHECK (`f6` >= 0)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE long_enough_name;
+CREATE TABLE test.t(t int COMMENT 't_comment' CHECK(t>0));
+SHOW CREATE TABLE test.t;
+Table Create Table
+t CREATE TABLE `t` (
+ `t` int(11) DEFAULT NULL COMMENT 't_comment' CHECK (`t` > 0)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP table test.t;
+SET @OLD_SQL_MODE=@@SQL_MODE;
+SET SQL_MODE='IGNORE_BAD_TABLE_OPTIONS';
+CREATE TABLE test.t (f int foo=bar check(f>0));
+Warnings:
+Warning 1911 Unknown option 'foo'
+SHOW CREATE TABLE t;
+Table Create Table
+t CREATE TABLE `t` (
+ `f` int(11) DEFAULT NULL `foo`=bar CHECK (`f` > 0)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP table test.t;
+SET @@SQL_MODE=@OLD_SQL_MODE;
create table t1 (a int check (a>10)) select 100 as 'a';
show create table t1;
Table Create Table
diff --git a/mysql-test/main/constraints.test b/mysql-test/main/constraints.test
index c06f585d04f..d7a5b41d708 100644
--- a/mysql-test/main/constraints.test
+++ b/mysql-test/main/constraints.test
@@ -1,10 +1,6 @@
#
# Testing of constraints
#
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
create table t1 (a int check (a>0));
show create table t1;
insert into t1 values (1);
@@ -104,7 +100,24 @@ SHOW CREATE TABLE long_enough_name;
DROP TABLE long_enough_name;
#
-# Check that we don't loose constraints as part of CREATE ... SELECT
+# MDEV-17654 Incorrect syntax returned for column with CHECK constraint
+# in the "SHOW CREATE TABLE ..." result
+#
+
+CREATE TABLE test.t(t int COMMENT 't_comment' CHECK(t>0));
+SHOW CREATE TABLE test.t;
+DROP table test.t;
+
+SET @OLD_SQL_MODE=@@SQL_MODE;
+SET SQL_MODE='IGNORE_BAD_TABLE_OPTIONS';
+
+CREATE TABLE test.t (f int foo=bar check(f>0));
+SHOW CREATE TABLE t;
+DROP table test.t;
+SET @@SQL_MODE=@OLD_SQL_MODE;
+
+#
+# Check that we don't lose constraints as part of CREATE ... SELECT
#
create table t1 (a int check (a>10)) select 100 as 'a';
diff --git a/mysql-test/main/cte_nonrecursive.result b/mysql-test/main/cte_nonrecursive.result
index 4fea05f79b4..2556fd4b06b 100644
--- a/mysql-test/main/cte_nonrecursive.result
+++ b/mysql-test/main/cte_nonrecursive.result
@@ -244,7 +244,7 @@ with t as (select distinct a from t1 where b >= 'c')
select * from t as r1, t as r2 where r1.a=r2.a;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 8 Using where
-1 PRIMARY <derived3> ref key0 key0 5 r1.a 2
+1 PRIMARY <derived3> ref key0 key0 5 r1.a 1
3 DERIVED t1 ALL NULL NULL NULL NULL 8 Using where; Using temporary
2 DERIVED t1 ALL NULL NULL NULL NULL 8 Using where; Using temporary
explain
@@ -253,7 +253,7 @@ select * from (select distinct a from t1 where b >= 'c') as r1,
where r1.a=r2.a;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 8 Using where
-1 PRIMARY <derived3> ref key0 key0 5 r1.a 2
+1 PRIMARY <derived3> ref key0 key0 5 r1.a 1
3 DERIVED t1 ALL NULL NULL NULL NULL 8 Using where; Using temporary
2 DERIVED t1 ALL NULL NULL NULL NULL 8 Using where; Using temporary
# two references to t specified by a query
@@ -369,7 +369,7 @@ select c as a from t2 where c < 4)
select * from t2,t where t2.c=t.a;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 4 Using where
-1 PRIMARY <derived2> ref key0 key0 5 test.t2.c 2
+1 PRIMARY <derived2> ref key0 key0 5 test.t2.c 1
2 DERIVED t1 ALL NULL NULL NULL NULL 8 Using where
3 UNION t2 ALL NULL NULL NULL NULL 4 Using where
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
@@ -381,7 +381,7 @@ select c as a from t2 where c < 4) as t
where t2.c=t.a;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 4 Using where
-1 PRIMARY <derived2> ref key0 key0 5 test.t2.c 2
+1 PRIMARY <derived2> ref key0 key0 5 test.t2.c 1
2 DERIVED t1 ALL NULL NULL NULL NULL 8 Using where
3 UNION t2 ALL NULL NULL NULL NULL 4 Using where
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
diff --git a/mysql-test/main/derived.result b/mysql-test/main/derived.result
index 9874f16aa8a..abf087f891c 100644
--- a/mysql-test/main/derived.result
+++ b/mysql-test/main/derived.result
@@ -1195,3 +1195,57 @@ drop table t1,t2,t3;
#
# End of 10.2 tests
#
+#
+# MDEV-9959: A serious MariaDB server performance bug
+#
+create table t1(a int);
+insert into t1 values (1),(2),(3),(4),(5),(6);
+create table t2(a int, b int,c int);
+insert into t2(a,b,c) values (1,1,2),(2,2,3),(3,1,4),(4,2,2),(5,1,1),(6,2,5);
+create table t3(a int, b int);
+insert into t3(a,b) values (1,1),(2,2),(2,1),(1,2),(5,1),(9,2);
+table "<derived2>" should have type=ref and rows=1
+one select in derived table
+with distinct
+analyze select * from t1 , ((select distinct t2.a from t2 order by c))q where t1.a=q.a;
+id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 6 6.00 100.00 100.00 Using where
+1 PRIMARY <derived2> ref key0 key0 5 test.t1.a 1 1.00 100.00 100.00
+2 DERIVED t2 ALL NULL NULL NULL NULL 6 6.00 100.00 100.00 Using temporary; Using filesort
+analyze select * from t1 , ((select distinct t2.a, t2.b from t2 order by c))q where t1.a=q.a;
+id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 6 6.00 100.00 100.00 Using where
+1 PRIMARY <derived2> ref key0 key0 5 test.t1.a 2 1.00 100.00 100.00
+2 DERIVED t2 ALL NULL NULL NULL NULL 6 6.00 100.00 100.00 Using temporary; Using filesort
+# multiple selects in derived table
+# NO UNION ALL
+analyze select * from t1 , ( (select t2.a from t2 order by c) union (select t2.a from t2 order by c))q where t1.a=q.a;
+id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 6 6.00 100.00 100.00 Using where
+1 PRIMARY <derived2> ref key0 key0 5 test.t1.a 1 1.00 100.00 100.00
+2 DERIVED t2 ALL NULL NULL NULL NULL 6 6.00 100.00 100.00
+3 UNION t2 ALL NULL NULL NULL NULL 6 6.00 100.00 100.00
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL 6.00 NULL NULL
+select * from t1 , ( (select t2.a from t2 order by c) union (select t2.a from t2 order by c))q where t1.a=q.a;
+a a
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+# UNION ALL and EXCEPT
+analyze select * from t1 , ( (select t2.a from t2 order by c) union all (select t2.a from t2 order by c) except(select t3.a from t3 order by b))q where t1.a=q.a;
+id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 6 6.00 100.00 100.00 Using where
+1 PRIMARY <derived2> ref key0 key0 5 test.t1.a 1 0.50 100.00 100.00
+2 DERIVED t2 ALL NULL NULL NULL NULL 6 6.00 100.00 100.00
+3 UNION t2 ALL NULL NULL NULL NULL 6 6.00 100.00 100.00
+4 EXCEPT t3 ALL NULL NULL NULL NULL 6 6.00 100.00 100.00
+NULL UNIT RESULT <unit2,3,4> ALL NULL NULL NULL NULL NULL 3.00 NULL NULL
+select * from t1 , ( (select t2.a from t2 order by c) union all (select t2.a from t2 order by c) except(select t3.a from t3 order by b))q where t1.a=q.a;
+a a
+3 3
+4 4
+6 6
+drop table t1,t2,t3;
diff --git a/mysql-test/main/derived.test b/mysql-test/main/derived.test
index 6c51f23c51e..990f955450a 100644
--- a/mysql-test/main/derived.test
+++ b/mysql-test/main/derived.test
@@ -1032,3 +1032,33 @@ drop table t1,t2,t3;
--echo #
--echo # End of 10.2 tests
--echo #
+
+--echo #
+--echo # MDEV-9959: A serious MariaDB server performance bug
+--echo #
+
+create table t1(a int);
+insert into t1 values (1),(2),(3),(4),(5),(6);
+create table t2(a int, b int,c int);
+insert into t2(a,b,c) values (1,1,2),(2,2,3),(3,1,4),(4,2,2),(5,1,1),(6,2,5);
+create table t3(a int, b int);
+insert into t3(a,b) values (1,1),(2,2),(2,1),(1,2),(5,1),(9,2);
+
+--echo table "<derived2>" should have type=ref and rows=1
+--echo one select in derived table
+
+--echo with distinct
+analyze select * from t1 , ((select distinct t2.a from t2 order by c))q where t1.a=q.a;
+analyze select * from t1 , ((select distinct t2.a, t2.b from t2 order by c))q where t1.a=q.a;
+
+--echo # multiple selects in derived table
+--echo # NO UNION ALL
+analyze select * from t1 , ( (select t2.a from t2 order by c) union (select t2.a from t2 order by c))q where t1.a=q.a;
+select * from t1 , ( (select t2.a from t2 order by c) union (select t2.a from t2 order by c))q where t1.a=q.a;
+
+--echo # UNION ALL and EXCEPT
+analyze select * from t1 , ( (select t2.a from t2 order by c) union all (select t2.a from t2 order by c) except(select t3.a from t3 order by b))q where t1.a=q.a;
+
+select * from t1 , ( (select t2.a from t2 order by c) union all (select t2.a from t2 order by c) except(select t3.a from t3 order by b))q where t1.a=q.a;
+
+drop table t1,t2,t3;
diff --git a/mysql-test/main/derived_view.result b/mysql-test/main/derived_view.result
index 45de32d1ee1..28c3e2958e9 100644
--- a/mysql-test/main/derived_view.result
+++ b/mysql-test/main/derived_view.result
@@ -1525,7 +1525,7 @@ EXPLAIN
SELECT a FROM t1 WHERE (a,b) IN (SELECT * FROM v2);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
-1 PRIMARY <derived3> ref key0 key0 10 test.t1.a,test.t1.b 2 FirstMatch(t1)
+1 PRIMARY <derived3> ref key0 key0 10 test.t1.a,test.t1.b 1 FirstMatch(t1)
3 DERIVED t2 ALL NULL NULL NULL NULL 6
4 UNION t3 ALL NULL NULL NULL NULL 4
NULL UNION RESULT <union3,4> ALL NULL NULL NULL NULL NULL
diff --git a/mysql-test/main/events_grant.result b/mysql-test/main/events_grant.result
index 51b80742737..cc7796975a6 100644
--- a/mysql-test/main/events_grant.result
+++ b/mysql-test/main/events_grant.result
@@ -23,7 +23,7 @@ SHOW GRANTS;
Grants for ev_test@localhost
GRANT USAGE ON *.* TO 'ev_test'@'localhost'
GRANT ALL PRIVILEGES ON `events_test`.* TO 'ev_test'@'localhost'
-GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, TRIGGER, DELETE VERSIONING ROWS ON `events_test2`.* TO 'ev_test'@'localhost'
+GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, TRIGGER, DELETE HISTORY ON `events_test2`.* TO 'ev_test'@'localhost'
"Here comes an error:";
SHOW EVENTS;
ERROR 42000: Access denied for user 'ev_test'@'localhost' to database 'events_test2'
diff --git a/mysql-test/main/func_gconcat.result b/mysql-test/main/func_gconcat.result
index 723a1952d79..1701bb364e8 100644
--- a/mysql-test/main/func_gconcat.result
+++ b/mysql-test/main/func_gconcat.result
@@ -1378,5 +1378,19 @@ group_concat(a,b limit ?)
1a,1b,2x,2y
drop table t2;
#
+# MDEV-18943: Group Concat with limit not working with views
+#
+create table t1 (a int, b varchar(10));
+insert into t1 values(1,'a'),(1,'b'),(NULL,'c'),(2,'x'),(2,'y');
+select group_concat(a,b limit 2) from t1;
+group_concat(a,b limit 2)
+1a,1b
+create view v1 as select group_concat(a,b limit 2) from t1;
+select * from v1;
+group_concat(a,b limit 2)
+1a,1b
+drop view v1;
+drop table t1;
+#
# End of 10.3 tests
#
diff --git a/mysql-test/main/func_gconcat.test b/mysql-test/main/func_gconcat.test
index 5cbc6969e02..b8ab96bdea4 100644
--- a/mysql-test/main/func_gconcat.test
+++ b/mysql-test/main/func_gconcat.test
@@ -986,5 +986,17 @@ execute STMT using @x;
drop table t2;
--echo #
+--echo # MDEV-18943: Group Concat with limit not working with views
+--echo #
+
+create table t1 (a int, b varchar(10));
+insert into t1 values(1,'a'),(1,'b'),(NULL,'c'),(2,'x'),(2,'y');
+select group_concat(a,b limit 2) from t1;
+create view v1 as select group_concat(a,b limit 2) from t1;
+select * from v1;
+drop view v1;
+drop table t1;
+
+--echo #
--echo # End of 10.3 tests
--echo #
diff --git a/mysql-test/main/grant.result b/mysql-test/main/grant.result
index 46d87a4777f..fad874d7d64 100644
--- a/mysql-test/main/grant.result
+++ b/mysql-test/main/grant.result
@@ -227,7 +227,7 @@ revoke LOCK TABLES, ALTER on mysqltest.* from mysqltest_1@localhost;
show grants for mysqltest_1@localhost;
Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
-GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, CREATE TEMPORARY TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, TRIGGER, DELETE VERSIONING ROWS ON `mysqltest`.* TO 'mysqltest_1'@'localhost' WITH GRANT OPTION
+GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, CREATE TEMPORARY TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, TRIGGER, DELETE HISTORY ON `mysqltest`.* TO 'mysqltest_1'@'localhost' WITH GRANT OPTION
revoke all privileges on mysqltest.* from mysqltest_1@localhost;
delete from mysql.user where user='mysqltest_1';
flush privileges;
@@ -664,8 +664,8 @@ SELECT TABLE_SCHEMA, TABLE_NAME, GROUP_CONCAT(PRIVILEGE_TYPE ORDER BY
PRIVILEGE_TYPE SEPARATOR ', ') AS PRIVILEGES FROM TABLE_PRIVILEGES WHERE GRANTEE
= '\'dummy\'@\'localhost\'' GROUP BY TABLE_SCHEMA, TABLE_NAME;
TABLE_SCHEMA TABLE_NAME PRIVILEGES
-mysqltest dummytable ALTER, CREATE, CREATE VIEW, DELETE, DELETE VERSIONING ROWS, DROP, INDEX, INSERT, REFERENCES, SELECT, SHOW VIEW, TRIGGER, UPDATE
-mysqltest dummyview ALTER, CREATE, CREATE VIEW, DELETE, DELETE VERSIONING ROWS, DROP, INDEX, INSERT, REFERENCES, SELECT, SHOW VIEW, TRIGGER, UPDATE
+mysqltest dummytable ALTER, CREATE, CREATE VIEW, DELETE, DELETE HISTORY, DROP, INDEX, INSERT, REFERENCES, SELECT, SHOW VIEW, TRIGGER, UPDATE
+mysqltest dummyview ALTER, CREATE, CREATE VIEW, DELETE, DELETE HISTORY, DROP, INDEX, INSERT, REFERENCES, SELECT, SHOW VIEW, TRIGGER, UPDATE
FLUSH PRIVILEGES;
SHOW GRANTS FOR dummy@localhost;
Grants for dummy@localhost
@@ -676,8 +676,8 @@ SELECT TABLE_SCHEMA, TABLE_NAME, GROUP_CONCAT(PRIVILEGE_TYPE ORDER BY
PRIVILEGE_TYPE SEPARATOR ', ') AS PRIVILEGES FROM TABLE_PRIVILEGES WHERE GRANTEE
= '\'dummy\'@\'localhost\'' GROUP BY TABLE_SCHEMA, TABLE_NAME;
TABLE_SCHEMA TABLE_NAME PRIVILEGES
-mysqltest dummytable ALTER, CREATE, CREATE VIEW, DELETE, DELETE VERSIONING ROWS, DROP, INDEX, INSERT, REFERENCES, SELECT, SHOW VIEW, TRIGGER, UPDATE
-mysqltest dummyview ALTER, CREATE, CREATE VIEW, DELETE, DELETE VERSIONING ROWS, DROP, INDEX, INSERT, REFERENCES, SELECT, SHOW VIEW, TRIGGER, UPDATE
+mysqltest dummytable ALTER, CREATE, CREATE VIEW, DELETE, DELETE HISTORY, DROP, INDEX, INSERT, REFERENCES, SELECT, SHOW VIEW, TRIGGER, UPDATE
+mysqltest dummyview ALTER, CREATE, CREATE VIEW, DELETE, DELETE HISTORY, DROP, INDEX, INSERT, REFERENCES, SELECT, SHOW VIEW, TRIGGER, UPDATE
SHOW FIELDS FROM mysql.tables_priv;
Field Type Null Key Default Extra
Host char(60) NO PRI
diff --git a/mysql-test/main/information_schema.result b/mysql-test/main/information_schema.result
index dd093aae5e9..b4d2d065d4a 100644
--- a/mysql-test/main/information_schema.result
+++ b/mysql-test/main/information_schema.result
@@ -493,7 +493,7 @@ GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE
'mysqltest_1'@'localhost' def test ALTER ROUTINE YES
'mysqltest_1'@'localhost' def test EVENT YES
'mysqltest_1'@'localhost' def test TRIGGER YES
-'mysqltest_1'@'localhost' def test DELETE VERSIONING ROWS YES
+'mysqltest_1'@'localhost' def test DELETE HISTORY YES
select * from information_schema.TABLE_PRIVILEGES where grantee like '%mysqltest_1%';
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE
'mysqltest_1'@'localhost' def test t1 SELECT NO
diff --git a/mysql-test/main/join_cache.result b/mysql-test/main/join_cache.result
index 681d6f1fca2..999ed500a84 100644
--- a/mysql-test/main/join_cache.result
+++ b/mysql-test/main/join_cache.result
@@ -5202,7 +5202,7 @@ SELECT * FROM (SELECT DISTINCT * FROM t1) t
WHERE t.a IN (SELECT t2.a FROM t2);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 4 Using where; Start temporary
-1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 2 End temporary
+1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 1 End temporary
2 DERIVED t1 ALL NULL NULL NULL NULL 3 Using temporary
SELECT * FROM (SELECT DISTINCT * FROM t1) t
WHERE t.a IN (SELECT t2.a FROM t2);
@@ -5213,8 +5213,8 @@ EXPLAIN
SELECT * FROM (SELECT DISTINCT * FROM t1) t
WHERE t.a IN (SELECT t2.a FROM t2);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3
-1 PRIMARY t2 ALL NULL NULL NULL NULL 4 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join)
+1 PRIMARY t2 ALL NULL NULL NULL NULL 4 Using where; Start temporary
+1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 1 End temporary
2 DERIVED t1 ALL NULL NULL NULL NULL 3 Using temporary
SELECT * FROM (SELECT DISTINCT * FROM t1) t
WHERE t.a IN (SELECT t2.a FROM t2);
diff --git a/mysql-test/main/subselect_extra.result b/mysql-test/main/subselect_extra.result
index edae4abfb3d..c654fdfca13 100644
--- a/mysql-test/main/subselect_extra.result
+++ b/mysql-test/main/subselect_extra.result
@@ -413,7 +413,7 @@ EXPLAIN
SELECT a FROM t1 WHERE (a,b) IN (SELECT * FROM v2);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
-1 PRIMARY <derived3> ref key0 key0 10 test.t1.a,test.t1.b 2 FirstMatch(t1)
+1 PRIMARY <derived3> ref key0 key0 10 test.t1.a,test.t1.b 1 FirstMatch(t1)
3 DERIVED t2 ALL NULL NULL NULL NULL 6
4 UNION t3 ALL NULL NULL NULL NULL 4
NULL UNION RESULT <union3,4> ALL NULL NULL NULL NULL NULL
diff --git a/mysql-test/main/subselect_extra_no_semijoin.result b/mysql-test/main/subselect_extra_no_semijoin.result
index 8aca24b6097..faeaf75c590 100644
--- a/mysql-test/main/subselect_extra_no_semijoin.result
+++ b/mysql-test/main/subselect_extra_no_semijoin.result
@@ -415,7 +415,7 @@ EXPLAIN
SELECT a FROM t1 WHERE (a,b) IN (SELECT * FROM v2);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
-2 DEPENDENT SUBQUERY <derived3> index_subquery key0 key0 10 func,func 2 Using where
+2 DEPENDENT SUBQUERY <derived3> index_subquery key0 key0 10 func,func 1 Using where
3 DERIVED t2 ALL NULL NULL NULL NULL 6
4 UNION t3 ALL NULL NULL NULL NULL 4
NULL UNION RESULT <union3,4> ALL NULL NULL NULL NULL NULL
diff --git a/mysql-test/main/trigger.result b/mysql-test/main/trigger.result
index 1adf3c68a08..ab9dbc63888 100644
--- a/mysql-test/main/trigger.result
+++ b/mysql-test/main/trigger.result
@@ -1964,7 +1964,7 @@ ERROR HY000: Can't update table 't2' in stored function/trigger because it is al
DROP TABLE t1;
DROP TRIGGER t_insert;
DROP TABLE t2;
-End of 5.0 tests
+# End of 5.0 tests
drop table if exists table_25411_a;
drop table if exists table_25411_b;
create table table_25411_a(a int);
@@ -2135,7 +2135,7 @@ b
# Work around Bug#45235
DROP DATABASE db1;
USE test;
-End of 5.1 tests.
+# End of 5.1 tests.
create table t1 (i int);
create table t2 (i int);
flush tables;
@@ -2154,7 +2154,7 @@ select * from t2;
i
2
drop table t1,t2;
-End of 5.2 tests.
+# End of 5.2 tests.
#
# Bug#34453 Can't change size of file (Errcode: 1224)
#
@@ -2257,7 +2257,7 @@ c
aaa
DROP TABLE t1;
-End of 5.5 tests.
+# End of 5.5 tests.
#
# BUG #910083: materialized subquery in a trigger
#
@@ -2304,7 +2304,7 @@ b
SET optimizer_switch=@save_optimizer_switch;
DROP TRIGGER tr;
DROP TABLE t1, t2;
-End of 5.3 tests.
+# End of 5.3 tests.
set time_zone="+00:00";
SET TIMESTAMP=UNIX_TIMESTAMP('2001-01-01 10:20:30');
SET @@session.sql_mode = 'STRICT_ALL_TABLES,STRICT_TRANS_TABLES';
@@ -2411,7 +2411,24 @@ AFTER UPDATE ON t1 FOR EACH ROW SELECT (SELECT b FROM t2) INTO @x;
# Running 20000 queries
DROP TABLE t1,t2;
#
-# Start of 10.3 tests
+# MDEV-19188 Server Crash When Using a Trigger With A Number of Virtual Columns on INSERT/UPDATE
+#
+CREATE TABLE t1 (
+virt1 INT GENERATED ALWAYS AS (0) VIRTUAL,
+virt2 INT GENERATED ALWAYS AS (0) VIRTUAL,
+virt3 INT GENERATED ALWAYS AS (0) VIRTUAL,
+virt4 INT GENERATED ALWAYS AS (0) VIRTUAL,
+virt5 INT GENERATED ALWAYS AS (0) VIRTUAL,
+virt6 INT GENERATED ALWAYS AS (0) VIRTUAL,
+virt7 INT GENERATED ALWAYS AS (0) VIRTUAL,
+virt8 INT GENERATED ALWAYS AS (0) VIRTUAL
+);
+INSERT INTO t1 () VALUES ();
+CREATE TRIGGER t1_trigger BEFORE INSERT ON t1 FOR EACH ROW BEGIN END;
+INSERT INTO t1 () VALUES ();
+DROP TABLE t1;
+#
+# End of 10.2 tests
#
#
# MDEV-12461 TYPE OF and ROW TYPE OF anchored data types
@@ -2430,3 +2447,6 @@ SELECT * FROM t1;
a b total
10 20 30
DROP TABLE t1;
+#
+# End of 10.3 tests
+#
diff --git a/mysql-test/main/trigger.test b/mysql-test/main/trigger.test
index 020117e046f..2eeab16ec5a 100644
--- a/mysql-test/main/trigger.test
+++ b/mysql-test/main/trigger.test
@@ -2184,7 +2184,7 @@ DROP TABLE t1;
DROP TRIGGER t_insert;
DROP TABLE t2;
---echo End of 5.0 tests
+--echo # End of 5.0 tests
#
# Bug#25411 (trigger code truncated)
@@ -2406,7 +2406,7 @@ let $MYSQLD_DATADIR = `select @@datadir`;
DROP DATABASE db1;
USE test;
---echo End of 5.1 tests.
+--echo # End of 5.1 tests.
#
# Test that using a trigger will not open mysql.proc
@@ -2430,7 +2430,7 @@ select * from t1;
select * from t2;
drop table t1,t2;
---echo End of 5.2 tests.
+--echo # End of 5.2 tests.
--echo #
--echo # Bug#34453 Can't change size of file (Errcode: 1224)
@@ -2574,7 +2574,7 @@ SELECT c FROM t1;
DROP TABLE t1;
--echo
---echo End of 5.5 tests.
+--echo # End of 5.5 tests.
--echo #
--echo # BUG #910083: materialized subquery in a trigger
@@ -2613,7 +2613,7 @@ SET optimizer_switch=@save_optimizer_switch;
DROP TRIGGER tr;
DROP TABLE t1, t2;
---echo End of 5.3 tests.
+--echo # End of 5.3 tests.
#
# MDEV-4829 BEFORE INSERT triggers dont issue 1406 error
@@ -2737,9 +2737,27 @@ while ($n)
DROP TABLE t1,t2;
+--echo #
+--echo # MDEV-19188 Server Crash When Using a Trigger With A Number of Virtual Columns on INSERT/UPDATE
+--echo #
+
+CREATE TABLE t1 (
+ virt1 INT GENERATED ALWAYS AS (0) VIRTUAL,
+ virt2 INT GENERATED ALWAYS AS (0) VIRTUAL,
+ virt3 INT GENERATED ALWAYS AS (0) VIRTUAL,
+ virt4 INT GENERATED ALWAYS AS (0) VIRTUAL,
+ virt5 INT GENERATED ALWAYS AS (0) VIRTUAL,
+ virt6 INT GENERATED ALWAYS AS (0) VIRTUAL,
+ virt7 INT GENERATED ALWAYS AS (0) VIRTUAL,
+ virt8 INT GENERATED ALWAYS AS (0) VIRTUAL
+);
+INSERT INTO t1 () VALUES ();
+CREATE TRIGGER t1_trigger BEFORE INSERT ON t1 FOR EACH ROW BEGIN END;
+INSERT INTO t1 () VALUES ();
+DROP TABLE t1;
--echo #
---echo # Start of 10.3 tests
+--echo # End of 10.2 tests
--echo #
--echo #
@@ -2760,3 +2778,7 @@ DELIMITER ;$$
INSERT INTO t1 (a,b) VALUES (10, 20);
SELECT * FROM t1;
DROP TABLE t1;
+
+--echo #
+--echo # End of 10.3 tests
+--echo #