diff options
author | Sergey Petrunya <psergey@askmonty.org> | 2014-12-18 20:06:49 +0300 |
---|---|---|
committer | Sergey Petrunya <psergey@askmonty.org> | 2014-12-18 20:06:49 +0300 |
commit | b75090c7dede338236b98ace65362348579ffa01 (patch) | |
tree | 5a87a06e9c57400d51c69fc22b83c01e771d0567 /mysql-test/t/mdev6830.test | |
parent | c9742ceac5bd682e24a435c36524305eecca7950 (diff) | |
download | mariadb-git-b75090c7dede338236b98ace65362348579ffa01.tar.gz |
MDEV-6830: Server crashes in best_access_path after a sequence of SELECTs ...
generate_derived_keys_for_table() did not work correctly in the case where
- it had a potential index on derived table
- however, TABLE::check_tmp_key() would disallow creation of this index
after looking at its future key parts (because of the key parts exceeding
max. index length)
- the code would leave a KEYUSE structure that refers to a non-existant index.
Depending on further optimizer calculations, this could cause a crash.
Diffstat (limited to 'mysql-test/t/mdev6830.test')
-rw-r--r-- | mysql-test/t/mdev6830.test | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/mysql-test/t/mdev6830.test b/mysql-test/t/mdev6830.test new file mode 100644 index 00000000000..24565d04fed --- /dev/null +++ b/mysql-test/t/mdev6830.test @@ -0,0 +1,63 @@ + +--source include/have_debug.inc + +--disable_warnings +drop table if exists t1,t2,t3; +drop view if exists v2,v3; +--enable_warnings +CREATE TABLE t1 (pk INT PRIMARY KEY) ENGINE=MyISAM; + +CREATE TABLE t2 ( + f1 DATE, + f2 VARCHAR(1024), + f3 VARCHAR(10), + f4 DATE, + f5 VARCHAR(10), + f6 VARCHAR(10), + f7 VARCHAR(10), + f8 DATETIME, + f9 INT, + f10 VARCHAR(1024), + f11 VARCHAR(1024), + f12 INT, + f13 VARCHAR(1024) +) ENGINE=MyISAM; + +CREATE OR REPLACE VIEW v2 AS SELECT * FROM t2; + +CREATE TABLE t3 ( + f1 VARCHAR(1024), + f2 VARCHAR(1024), + f3 DATETIME, + f4 VARCHAR(10), + f5 INT, + f6 VARCHAR(10), + f7 VARCHAR(1024), + f8 VARCHAR(10), + f9 INT, + f10 DATE, + f11 INT, + f12 VARCHAR(1024), + f13 VARCHAR(10), + f14 DATE, + f15 DATETIME +) ENGINE=MyISAM; + +CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v3 AS SELECT * FROM t3; + +INSERT INTO t3 VALUES + ('FOO','foo','2000-08-04 00:00:00','one',1,'1','FOO','foo',1,'2004-05-09',1,'one','one','2001-12-07','2001-10-17 08:25:04'), + ('BAR','bar','2001-01-01 04:52:37','two',2,'2','BAR','bar',2,'2008-01-01',2,'two','two','2006-06-19','2002-01-01 08:22:49'); + +CREATE TABLE t4 (f1 VARCHAR(10), f2 INT) ENGINE=MyISAM; + +SELECT * FROM t1; + +--error ER_BAD_FIELD_ERROR +SELECT non_existing FROM v2; + +SELECT * FROM t1, v3, t4 WHERE v3.f1 = t4.f1 AND t4.f2 = 6 AND t1.pk = v3.f5; + +drop table t1,t2,t3,t4; +drop view v2,v3; + |