summaryrefslogtreecommitdiff
path: root/mysql-test/r/subselect4.result
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2011-10-26 20:25:18 +0300
committerMichael Widenius <monty@askmonty.org>2011-10-26 20:25:18 +0300
commitfa36a7426bf505e83cbd03d8e54e433b3df4d72e (patch)
tree182fd923b34d7ca56906140214c1c4730d1c47ea /mysql-test/r/subselect4.result
parent16942bc5ca0f239c2aa2c2cde4eaba144495e9aa (diff)
downloadmariadb-git-fa36a7426bf505e83cbd03d8e54e433b3df4d72e.tar.gz
Fixed lp:879939 "assertion in ha_maria::enable_indexes with derived_with_keys=on"
Honor unique/not unique when creating keys for internal tempory tables. Added new variables to be used to limit how keys are created for internal temporary tables. include/maria.h: Added maria_max_key_length() and maria_max_key_segments() include/myisam.h: Added myisam_max_key_length() and myisam_max_key_segments() mysql-test/r/mysql.result: Drop all used tables mysql-test/r/subselect4.result: Added test case for lp:879939 mysql-test/t/mysql.test: Drop all used tables mysql-test/t/subselect4.test: Added test case for lp:879939 sql/mysql_priv.h: Added internal_tmp_table_max_key_length and internal_tmp_table_max_key_segments to be used to limit how keys for derived tables are created. sql/mysqld.cc: Added internal_tmp_table_max_key_length and internal_tmp_table_max_key_segments to be used to limit how keys for derived tables are created. sql/share/errmsg.txt: Added new error message for internal errors sql/sql_select.cc: Give error if we try to create a wrong key (this error should never happen) Honor unique/not unique when creating keys for internal tempory tables. storage/maria/ha_maria.cc: Added change_table_ptr() to ensure that external_ref points always to the correct table. (Not having this caused an assert in the included test) storage/maria/ha_maria.h: Added change_table_ptr() to ensure that external_ref points always to the correct table. storage/maria/ma_check.c: Fixed bug in Duplicate key error printing (now row position is printed correctly) storage/maria/ma_create.c: maria_max_key_length() -> _ma_max_key_length() storage/maria/ma_info.c: Added extern function maria_max_key_length() to calculate the max key length based on current block size. storage/maria/ma_open.c: maria_max_key_length() -> _ma_max_key_length() storage/maria/maria_def.h: maria_max_key_length() -> _ma_max_key_length() storage/myisam/ha_myisam.cc: Added change_table_ptr() to ensure that external_ref points always to the correct table. (Not having this caused an assert in the included test) storage/myisam/ha_myisam.h: Added change_table_ptr() to ensure that external_ref points always to the correct table.
Diffstat (limited to 'mysql-test/r/subselect4.result')
-rw-r--r--mysql-test/r/subselect4.result35
1 files changed, 35 insertions, 0 deletions
diff --git a/mysql-test/r/subselect4.result b/mysql-test/r/subselect4.result
index 386ae0bdbde..bdc04ca2a11 100644
--- a/mysql-test/r/subselect4.result
+++ b/mysql-test/r/subselect4.result
@@ -2104,3 +2104,38 @@ NULL
deallocate prepare st1;
drop table t1, t2, t3;
set optimizer_switch=@subselect4_tmp;
+#
+# LP bug #879939: assertion in ha_maria::enable_indexes with derived_with_keys=on
+#
+CREATE TABLE t2 ( a varchar(3)) ;
+INSERT INTO t2 VALUES ('USA'),('USA'),('USA'),('USA'),('USA');
+CREATE TABLE t1 ( a varchar(3), b varchar(35)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES ('USA','Lansing'),('USA','Laredo'),('USA','Las Vegas'),('USA','Lexington-Fayett'),('USA','Lincoln'),('USA','Little Rock'),('USA','Livonia'),('USA','Long Beach'),('USA','Los Angeles'),('USA','Louisville'),('USA','Lowell'),('USA','Lubbock'),('USA','Macon'),('USA','Madison'),('USA','Manchester'),('USA','McAllen'),('USA','Memphis'),('USA','Mesa'),('USA','Mesquite'),('USA','Metairie'),('USA','Miami');
+CREATE TABLE t3 ( a varchar(35)) ENGINE=MyISAM;
+INSERT INTO t3 VALUES ('Miami');
+SET optimizer_switch = 'derived_with_keys=on';
+SET @@tmp_table_size=1024*4;
+explain SELECT * FROM (SELECT t1.* FROM t1, t2 ) AS alias1 JOIN t3 ON ( t3.a = alias1.b );
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t3 system NULL NULL NULL NULL 1
+1 PRIMARY <derived2> ref key0 key0 39 const 10
+2 DERIVED t2 ALL NULL NULL NULL NULL 5
+2 DERIVED t1 ALL NULL NULL NULL NULL 21 Using join buffer (flat, BNL join)
+SELECT * FROM (SELECT t1.* FROM t1, t2 ) AS alias1 JOIN t3 ON ( t3.a = alias1.b );
+a b a
+USA Miami Miami
+USA Miami Miami
+USA Miami Miami
+USA Miami Miami
+USA Miami Miami
+SET @@tmp_table_size=1024*1024*16;
+SELECT * FROM (SELECT t1.* FROM t1, t2 ) AS alias1 JOIN t3 ON ( t3.a = alias1.b );
+a b a
+USA Miami Miami
+USA Miami Miami
+USA Miami Miami
+USA Miami Miami
+USA Miami Miami
+drop table t1,t2,t3;
+SET optimizer_switch= @@global.optimizer_switch;
+set @@tmp_table_size= @@global.tmp_table_size;