summaryrefslogtreecommitdiff
path: root/sql/opt_table_elimination.cc
diff options
context:
space:
mode:
authorSergey Petrunya <psergey@askmonty.org>2013-08-22 14:12:10 +0400
committerSergey Petrunya <psergey@askmonty.org>2013-08-22 14:12:10 +0400
commit37e9714c5e3c15b324348114cda9069574a8e92f (patch)
treedefc8570f35507883685b19a88ddc21383929461 /sql/opt_table_elimination.cc
parentc97ae6b56f294690ec4c5d5795503c0725b0ce02 (diff)
downloadmariadb-git-37e9714c5e3c15b324348114cda9069574a8e92f.tar.gz
MDEV-4840: Wrong result (missing rows) on LEFT JOIN with InnoDB tables
Fix two problems in table elimination code: - Before marking a "value" as bound, check if it is already bound. Marking the same value as bound twice could confuse a module that depends on this value, because Dep_module_XXX use counters to know when they become bound. - When checking whether field is part of a key, ignore "extended keys" property.
Diffstat (limited to 'sql/opt_table_elimination.cc')
-rw-r--r--sql/opt_table_elimination.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/sql/opt_table_elimination.cc b/sql/opt_table_elimination.cc
index 33164c1ed12..4a10d402fac 100644
--- a/sql/opt_table_elimination.cc
+++ b/sql/opt_table_elimination.cc
@@ -892,8 +892,11 @@ bool Dep_analysis_context::run_wave(List<Dep_module> *new_bound_modules)
iter= module->init_unbound_values_iter(iter_buf);
while ((value= module->get_next_unbound_value(this, iter)))
{
- value->make_bound();
- new_bound_values.push_back(value);
+ if (!value->is_bound())
+ {
+ value->make_bound();
+ new_bound_values.push_back(value);
+ }
}
}
new_bound_modules->empty();
@@ -1740,7 +1743,7 @@ Dep_module* Dep_value_field::get_next_unbound_module(Dep_analysis_context *dac,
- have this field as a part of them
*/
while (key_dep && (key_dep->is_applicable() ||
- !field->part_of_key.is_set(key_dep->keyno)))
+ !field->part_of_key_not_clustered.is_set(key_dep->keyno)))
{
key_dep= key_dep->next_table_key;
}