From a7a4519a40c58947796c6d9b2e4e58acc18aeef8 Mon Sep 17 00:00:00 2001 From: Varun Gupta Date: Fri, 19 Jan 2018 13:29:31 +0530 Subject: MDEV-14241: Server crash in key_copy / get_matching_chain_by_join_key or valgrind warnings In this case we were using the optimization derived_with_keys but we could not create a key because the length of the key was greater than the max allowed(MI_MAX_KEY_LENGTH). To do the join we needed to create a hash join key instead, but in the explain output it showed that we were still referring to derived keys which were created but not used. --- mysql-test/t/derived.test | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'mysql-test/t/derived.test') diff --git a/mysql-test/t/derived.test b/mysql-test/t/derived.test index f8ba87ac1f5..eb6e502b029 100644 --- a/mysql-test/t/derived.test +++ b/mysql-test/t/derived.test @@ -864,5 +864,28 @@ select distinct t1.id, tt.id, tt.data drop table t1; +--echo # +--echo # MDEV-14241: Server crash in key_copy / get_matching_chain_by_join_key +--echo # or valgrind warnings +--echo # + +CREATE TABLE t1 (a VARCHAR(10)) ENGINE=MyISAM; +CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; +INSERT INTO t1 VALUES ('foo'),('bar'); + +CREATE TABLE t2 (b integer auto_increment primary key) ENGINE=MyISAM; +INSERT INTO t2 VALUES (NULL),(NULL); + +CREATE TABLE t3 (c VARCHAR(1024) CHARACTER SET utf8, d INT) ENGINE=MyISAM; +CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v3 AS SELECT * FROM t3; +INSERT INTO t3 VALUES ('abc',NULL),('def',4); + +SET join_cache_level= 8; +explain +SELECT * FROM v1, t2, v3 WHERE a = c AND b = d; +SELECT * FROM v1, t2, v3 WHERE a = c AND b = d; + +DROP VIEW v1, v3; +DROP TABLE t1, t2, t3; --echo # end of 5.5 -- cgit v1.2.1 From ba8d0fa700a73893979793785ed53f7bbd950df8 Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Mon, 15 Jan 2018 14:50:35 +0100 Subject: MDEV-14786: Server crashes in Item_cond::transform on 2nd execution of SP querying from a view MDEV-14957: JOIN::prepare gets unusable "conds" as argument Do not touch merged derived (it is irreversible) Fix first argument of in_optimizer for calls possible before fix_fields() --- mysql-test/t/derived.test | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'mysql-test/t/derived.test') diff --git a/mysql-test/t/derived.test b/mysql-test/t/derived.test index eb6e502b029..c5b792c8d4d 100644 --- a/mysql-test/t/derived.test +++ b/mysql-test/t/derived.test @@ -888,4 +888,19 @@ SELECT * FROM v1, t2, v3 WHERE a = c AND b = d; DROP VIEW v1, v3; DROP TABLE t1, t2, t3; +--echo # +--echo # MDEV-14786: Server crashes in Item_cond::transform on 2nd +--echo # execution of SP querying from a view +--echo # +create table t1 (i int, row_start timestamp(6) not null default now(), + row_end timestamp(6) not null default '2030-01-01 0:0:0'); +create view v1 as select i from t1 where i < 5 and (row_end = +TIMESTAMP'2030-01-01 0:0:0' or row_end is null); +create procedure pr(x int) select i from v1; +call pr(1); +call pr(2); +drop procedure pr; +drop view v1; +drop table t1; + --echo # end of 5.5 -- cgit v1.2.1