summaryrefslogtreecommitdiff
path: root/mysql-test/main/table_keyinfo-6838.test
blob: 5f4c9f44f8670cae139079507bf700cdbd30f1c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Test case for MDEV-6838.
# Due to incorrect key_length computation, this usecase failed with the error
# Using too big key for internal temp table.

CREATE TABLE t1 (i INT, state VARCHAR(997)) ENGINE=MyISAM;
INSERT INTO t1 VALUES (2,'Louisiana'),(9,'Maine');

CREATE TABLE t2 (state VARCHAR(997), j INT) ENGINE=MyISAM;
INSERT INTO t2 VALUES ('Louisiana',9),('Alaska',5);
INSERT INTO t2 SELECT t2.* FROM t2 JOIN t2 AS t3 JOIN t2 AS t4 JOIN t2 AS t5 JOIN t2 AS t6;

SET @@max_heap_table_size= 16384;
set @@optimizer_switch='derived_merge=OFF';
set @@optimizer_switch='extended_keys=ON';

SELECT * FROM t1 AS t1_1 LEFT JOIN ( t1 AS t1_2 INNER JOIN (SELECT * FROM t2) v2 ON t1_2.i = j ) ON t1_1.state = v2.state LIMIT 1;

DROP TABLE t1, t2;