diff options
author | Igor Babaev <igor@askmonty.org> | 2011-10-19 23:28:37 -0700 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2011-10-19 23:28:37 -0700 |
commit | 945f12cf8fc361844f3553599795beb549fc8c1d (patch) | |
tree | 3909d7a45593f23f0c82c224e94a16d66d124899 /sql | |
parent | 4720b6f68bfcec7b6fc4c3772ae61bbbc629ca5d (diff) | |
download | mariadb-git-945f12cf8fc361844f3553599795beb549fc8c1d.tar.gz |
Fixed LP bug #877316.
This bug happened due to incompleteness of the fix for bug 872735:
the occurrences of the fields in the conditions of correlated
subqueries were not taken into account when recalculating
covering keys bit maps.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item.cc | 6 | ||||
-rw-r--r-- | sql/item.h | 2 | ||||
-rw-r--r-- | sql/item_subselect.cc | 1 |
3 files changed, 9 insertions, 0 deletions
diff --git a/sql/item.cc b/sql/item.cc index 8710b8f9024..4d516aa33f8 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -2172,6 +2172,12 @@ bool Item_field::enumerate_field_refs_processor(uchar *arg) return FALSE; } +bool Item_field::covering_keys_processor(uchar *arg) +{ + if (field && field->table) + field->table->covering_keys.intersect(field->part_of_key); + return FALSE; +} const char *Item_ident::full_name() const { diff --git a/sql/item.h b/sql/item.h index efd358db874..cd79acdf3c3 100644 --- a/sql/item.h +++ b/sql/item.h @@ -1018,6 +1018,7 @@ public: virtual bool mark_as_eliminated_processor(uchar *arg) { return 0; } virtual bool eliminate_subselect_processor(uchar *arg) { return 0; } virtual bool set_fake_select_as_master_processor(uchar *arg) { return 0; } + virtual bool covering_keys_processor(uchar *arg) { return 0; } virtual bool view_used_tables_processor(uchar *arg) { return 0; } virtual bool eval_not_null_tables(uchar *opt_arg) { return 0; } virtual bool clear_sum_processor(uchar *opt_arg) { return 0; } @@ -1832,6 +1833,7 @@ public: bool vcol_in_partition_func_processor(uchar *bool_arg); bool check_vcol_func_processor(uchar *arg) { return FALSE;} bool enumerate_field_refs_processor(uchar *arg); + bool covering_keys_processor(uchar *arg); void cleanup(); Item_equal *get_item_equal() { return item_equal; } void set_item_equal(Item_equal *item_eq) { item_equal= item_eq; } diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index ebc9d47e3a8..7dc26adf97e 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -492,6 +492,7 @@ void Item_subselect::recalc_used_tables(st_select_lex *new_parent, upper->item->walk(&Item::enumerate_field_refs_processor, FALSE, (uchar*)&fixer); used_tables_cache |= fixer.used_tables; + upper->item->walk(&Item::covering_keys_processor, FALSE, NULL); /* if (after_pullout) upper->item->fix_after_pullout(new_parent, &(upper->item)); |