MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Sergey Petrunia Date:September 5 2008 7:23pm
Subject:bzr commit into mysql-6.0-opt branch (sergefp:2688) Bug#37851
View as plain text  
#At file:///home/spetrunia/dev/mysql-6.0-bug37977/

 2688 Sergey Petrunia	2008-09-05
      BUG#37851: Crash in test_if_skip_sort_order tab->select is zero
      - Don't touch tab->select->cond in test_if_skip_sort_order(). We only use tab->select_cond at
        this and later stages.
modified:
  mysql-test/r/myisam_mrr.result
  mysql-test/t/myisam_mrr.test
  sql/sql_select.cc

per-file messages:
  mysql-test/r/myisam_mrr.result
    BUG#37851: Crash in test_if_skip_sort_order tab->select is zero
    - Testcase
  mysql-test/t/myisam_mrr.test
    BUG#37851: Crash in test_if_skip_sort_order tab->select is zero
    - Testcase
  sql/sql_select.cc
    BUG#37851: Crash in test_if_skip_sort_order tab->select is zero
    - Don't touch tab->select->cond in test_if_skip_sort_order(). We only use tab->select_cond at
      this and later stages.
=== modified file 'mysql-test/r/myisam_mrr.result'
--- a/mysql-test/r/myisam_mrr.result	2008-01-10 22:04:59 +0000
+++ b/mysql-test/r/myisam_mrr.result	2008-09-05 19:23:07 +0000
@@ -303,3 +303,32 @@ ID	col1	key1	key2	text1	text2	col2	col3	
 3	NULL	1130	NULL	red	NULL	100	bodyandsubject	0
 4	NULL	1130	NULL	yellow	NULL	100	bodyandsubject	0
 drop table t1;
+
+BUG#37851: Crash in test_if_skip_sort_order tab->select is zero
+
+CREATE TABLE t1 (
+pk int(11) NOT NULL AUTO_INCREMENT,
+PRIMARY KEY (pk)
+);
+INSERT INTO t1 VALUES (1);
+CREATE TABLE t2 (
+pk int(11) NOT NULL AUTO_INCREMENT,
+int_key int(11) DEFAULT NULL,
+PRIMARY KEY (pk),
+KEY int_key (int_key)
+);
+INSERT INTO t2 VALUES (1,1),(2,6),(3,0);
+EXPLAIN EXTENDED
+SELECT MIN(t1.pk)
+FROM t1 WHERE EXISTS (
+SELECT t2.pk
+FROM t2
+WHERE t2.int_key IS NULL
+GROUP BY t2.pk
+);
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	PRIMARY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE
+2	SUBQUERY	t2	ALL	int_key	int_key	5		3	33.33	Using index condition; Using filesort
+Warnings:
+Note	1003	select min(`test`.`t1`.`pk`) AS `MIN(t1.pk)` from `test`.`t1` where 0
+DROP TABLE t1, t2;

=== modified file 'mysql-test/t/myisam_mrr.test'
--- a/mysql-test/t/myisam_mrr.test	2008-01-10 22:04:59 +0000
+++ b/mysql-test/t/myisam_mrr.test	2008-09-05 19:23:07 +0000
@@ -45,3 +45,32 @@ select * FROM t1 WHERE key1=1130 AND col
 
 drop table t1;
 
+
+--echo 
+--echo  BUG#37851: Crash in test_if_skip_sort_order tab->select is zero
+--echo 
+CREATE TABLE t1 (
+  pk int(11) NOT NULL AUTO_INCREMENT,
+  PRIMARY KEY (pk)
+);
+INSERT INTO t1 VALUES (1);
+
+CREATE TABLE t2 (
+  pk int(11) NOT NULL AUTO_INCREMENT,
+  int_key int(11) DEFAULT NULL,
+  PRIMARY KEY (pk),
+  KEY int_key (int_key)
+);
+INSERT INTO t2 VALUES (1,1),(2,6),(3,0);
+
+EXPLAIN EXTENDED
+SELECT MIN(t1.pk)
+FROM t1 WHERE EXISTS (
+ SELECT t2.pk
+ FROM t2
+ WHERE t2.int_key IS NULL
+ GROUP BY t2.pk
+);
+
+DROP TABLE t1, t2;
+

=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc	2008-09-05 14:36:37 +0000
+++ b/sql/sql_select.cc	2008-09-05 19:23:07 +0000
@@ -15910,7 +15910,7 @@ test_if_skip_sort_order(JOIN_TAB *tab,OR
       if (table->covering_keys.is_set(ref_key))
 	usable_keys.intersect(table->covering_keys);
       if (tab->pre_idx_push_select_cond)
-        tab->select_cond= tab->select->cond= tab->pre_idx_push_select_cond;
+        tab->select_cond= tab->pre_idx_push_select_cond;
       if ((new_ref_key= test_if_subkey(order, table, ref_key, ref_key_parts,
 				       &usable_keys)) < MAX_KEY)
       {
@@ -16170,7 +16170,7 @@ test_if_skip_sort_order(JOIN_TAB *tab,OR
             table->file->extra(HA_EXTRA_KEYREAD);
           }
           if (tab->pre_idx_push_select_cond)
-            tab->select_cond= tab->select->cond= tab->pre_idx_push_select_cond;
+            tab->select_cond= tab->pre_idx_push_select_cond;
           table->file->ha_index_or_rnd_end();
           if (join->select_options & SELECT_DESCRIBE)
           {

Thread
bzr commit into mysql-6.0-opt branch (sergefp:2688) Bug#37851Sergey Petrunia7 Sep