diff options
author | Sergey Petrunya <psergey@askmonty.org> | 2011-10-31 15:07:43 +0400 |
---|---|---|
committer | Sergey Petrunya <psergey@askmonty.org> | 2011-10-31 15:07:43 +0400 |
commit | 57b3fefa03055e579fbcf664ce71b3b41c6b4558 (patch) | |
tree | 052b221ec22f096687f025e7c1ddca55b6c4a592 /mysql-test/t/derived_view.test | |
parent | 3694bb90a47feb463c5a38543650f0f53d1735eb (diff) | |
download | mariadb-git-57b3fefa03055e579fbcf664ce71b3b41c6b4558.tar.gz |
BUG#882994: Crash in QUICK_RANGE_SELECT::reset with derived_with_keys
- The bug was caused by the following scenario:
= a quick select is created with get_quick_select_for_ref. The quick
select refers to temporary (derived) table. It saves table->file, which
refers to a ha_heap object.
= When temp table is populated, ha_heap reaches max. size and is converted
to a ha_myisam. However, quick->file remains pointing to where ha_heap
was.
= Attempt to use the quick select causes crash.
- Fixed by introducing QUICK_SELECT_I::replace_handler(). Note that it will
not work for index_merge quick selects. Which is fine, because these
quick selects are never created for derived tables.
Diffstat (limited to 'mysql-test/t/derived_view.test')
-rw-r--r-- | mysql-test/t/derived_view.test | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/mysql-test/t/derived_view.test b/mysql-test/t/derived_view.test index 667d6f6dfb9..c1a9435ef6c 100644 --- a/mysql-test/t/derived_view.test +++ b/mysql-test/t/derived_view.test @@ -1221,5 +1221,45 @@ SET @@tmp_table_size=default; drop table t1,t2,t3; +--echo # +--echo # BUG#882994: Crash in QUICK_RANGE_SELECT::reset with derived_with_keys +--echo # +CREATE TABLE t2 ( + pk varchar(33), + col_varchar_key varchar(3) NOT NULL, + col_varchar_nokey varchar(52) NOT NULL); + +INSERT INTO t2 VALUES ('NICSpanish','NIC','Spanish'), + ('NERHausa','NER','Hausa'),('NGAJoruba','NGA','Joruba'), + ('NIUNiue','NIU','Niue'),('NFKEnglish','NFK','English'), + ('NORNorwegian','NOR','Norwegian'),('CIVAkan','CIV','Akan'), + ('OMNArabic','OMN','Arabic'),('PAKPunjabi','PAK','Punjabi'), + ('PLWPalau','PLW','Palau'),('PANSpanish','PAN','Spanish'), + ('PNGPapuan Langua','PNG','Papuan Languages'), ('PRYSpanish','PRY','Spanish'), + ('PERSpanish','PER','Spanish'), ('PCNPitcairnese','PCN','Pitcairnese'), + ('MNPPhilippene La','MNP','Philippene Langu'),('PRTPortuguese','PRT','Portuguese'), + ('PRISpanish','PRI','Spanish'),('POLPolish','POL','Polish'),('GNQFang','GNQ','Fang'); + +CREATE TABLE t1 ( col_varchar_nokey varchar(52) NOT NULL ) ; +INSERT INTO t1 VALUES ('Chinese'),('English'),('French'),('German'), + ('Italian'),('Japanese'),('Korean'),('Polish'),('Portuguese'),('Spanish'), + ('Tagalog'),('Vietnamese'); +CREATE TABLE t3 ( col_varchar_key varchar(52)) ; +INSERT INTO t3 VALUES ('United States'); + +set @tmp_882994= @@max_heap_table_size; +--disable_warnings +set max_heap_table_size=1; +--enable_warnings + +SELECT * +FROM t3 JOIN +( SELECT t2.* FROM t1, t2 ) AS alias2 +ON ( alias2.col_varchar_nokey = t3.col_varchar_key ) +ORDER BY CONCAT(alias2.col_varchar_nokey); + +set max_heap_table_size= @tmp_882994; +drop table t1,t2,t3; + # The following command must be the last one the file set optimizer_switch=@exit_optimizer_switch; |