[Commits] Rev 4054: MDEV-5814: MySQL Bug#13948247 DIVISION BY 0 IN GET_BEST_DISJUNCT_QUICK WITH FORCE INDEX GROUP BY in file:///home/psergey/dev2/10.0/

Sergey Petrunya psergey at askmonty.org
Fri Mar 14 19:52:18 EET 2014


At file:///home/psergey/dev2/10.0/

------------------------------------------------------------
revno: 4054
revision-id: psergey at askmonty.org-20140314175216-ztbe8wskbc5ou7vn
parent: psergey at askmonty.org-20140314162313-hc7ulkv66ru761bs
committer: Sergey Petrunya <psergey at askmonty.org>
branch nick: 10.0
timestamp: Fri 2014-03-14 18:52:16 +0100
message:
  MDEV-5814: MySQL Bug#13948247 DIVISION BY 0 IN GET_BEST_DISJUNCT_QUICK WITH FORCE INDEX GROUP BY
  - Adopt MySQL's fix: don't run index_merge optimizer if the table statistics 
    reports that the table has 0 rows.
=== modified file 'mysql-test/r/blackhole.result'
--- a/mysql-test/r/blackhole.result	2012-03-28 08:22:31 +0000
+++ b/mysql-test/r/blackhole.result	2014-03-14 17:52:16 +0000
@@ -9,3 +9,11 @@ SELECT 1 FROM t1 WHERE a = ANY (SELECT a
 1
 DROP TABLE t1, t2;
 End of 5.5 tests 
+#
+# Bug#13948247 DIVISION BY 0 IN GET_BEST_DISJUNCT_QUICK WITH FORCE INDEX GROUP BY
+#
+CREATE TABLE t1(a INT, b INT, c INT, KEY(c), UNIQUE(a)) ENGINE = BLACKHOLE;
+SELECT 0 FROM t1 FORCE INDEX FOR GROUP BY(a) WHERE a = 0 OR b = 0 AND c = 0;
+0
+DROP TABLE t1;
+End of 5.6 tests

=== modified file 'mysql-test/t/blackhole.test'
--- a/mysql-test/t/blackhole.test	2012-03-28 08:22:31 +0000
+++ b/mysql-test/t/blackhole.test	2014-03-14 17:52:16 +0000
@@ -19,3 +19,12 @@ DROP TABLE t1, t2;
 
 --echo End of 5.5 tests 
 
+--echo #
+--echo # Bug#13948247 DIVISION BY 0 IN GET_BEST_DISJUNCT_QUICK WITH FORCE INDEX GROUP BY
+--echo #
+
+CREATE TABLE t1(a INT, b INT, c INT, KEY(c), UNIQUE(a)) ENGINE = BLACKHOLE;
+SELECT 0 FROM t1 FORCE INDEX FOR GROUP BY(a) WHERE a = 0 OR b = 0 AND c = 0;
+DROP TABLE t1;
+
+--echo End of 5.6 tests

=== modified file 'sql/opt_range.cc'
--- a/sql/opt_range.cc	2014-03-05 22:20:10 +0000
+++ b/sql/opt_range.cc	2014-03-14 17:52:16 +0000
@@ -3168,7 +3168,8 @@ int SQL_SELECT::test_quick_select(THD *t
         }
       }
 
-      if (optimizer_flag(thd, OPTIMIZER_SWITCH_INDEX_MERGE))
+      if (optimizer_flag(thd, OPTIMIZER_SWITCH_INDEX_MERGE) &&
+          head->stat_records() != 0)
       {
         /* Try creating index_merge/ROR-union scan. */
         SEL_IMERGE *imerge;



More information about the commits mailing list