From c7d335a7d2a50e957a5d02a89bf5cd17c06bd548 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 21 Feb 2006 00:17:29 +0300 Subject: [PATCH] BUG#15448 (group_min_max test failure): Don't bypass group-min-max optimizer entry point if we've got a tree of type ALWAYS or MAYBE. sql/opt_range.cc: BUG#15448 (group_min_max test failure): Don't buypass group-min-max optimizer entry point if we've got a tree of type ALWAYS or MAYBE. The effect observed by this bug has been introduced by this cset: ChangeSet 1.1967.5.2 2005/12/26 08:40:09 sergefp@mysql.com. The cset introduced PARAM::remove_jump_scans which purpose was to avoid making [always unsuccessful] attempts to construct index_merge for construct index_merge for conditions like "t.key1partX=c1 OR t.key1partY=c2". The effect of this change was that some queries that previously had produced a SEL_TREE representing candidate for index_merge(X,Y) now started to produce SEL_TREE with type=ALWAYS, and group-min-max analysis for these trees has been bypassed. In this fix we make SEL_TREE with type=ALWAYS to be processed in the same way as (SEL_TREE*)NULL, its equivalent. --- sql/opt_range.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sql/opt_range.cc b/sql/opt_range.cc index ef6b3d941a1..1146ea2428d 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -1951,9 +1951,12 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use, read_time= (double) HA_POS_ERROR; goto free_mem; } - if (tree->type != SEL_TREE::KEY && - tree->type != SEL_TREE::KEY_SMALLER) - goto free_mem; + /* + If the tree can't be used for range scans, proceed anyway, as we + can construct a group-min-max quick select + */ + if (tree->type != SEL_TREE::KEY && tree->type != SEL_TREE::KEY_SMALLER) + tree= NULL; } }