diff options
author | unknown <sanja@askmonty.org> | 2012-12-28 14:41:46 +0200 |
---|---|---|
committer | unknown <sanja@askmonty.org> | 2012-12-28 14:41:46 +0200 |
commit | 6f26aac9409e3456798e58a4ee4306e43c7ebf7b (patch) | |
tree | df8ad17736247d1493460205865fb75757a00ae1 /sql/item.h | |
parent | e99aa91e90adfd54cc1f460dd8cdd19614f30abc (diff) | |
download | mariadb-git-6f26aac9409e3456798e58a4ee4306e43c7ebf7b.tar.gz |
MDEV-3873 & MDEV-3876 & MDEV-3912 : Wrong result (extra rows) with ALL subquery
from a MERGE view.
The problem was in the lost ability to be null for the table of a left join if it
is a view/derived table.
It hapenned because setup_table_map(), was called earlier then we merged
the view or derived.
Fixed by propagating new maybe_null flag during Item::update_used_tables().
Change in join_outer.test and join_outer_jcl6.test appeared because
IS NULL reported no used tables (i.e. constant) for argument which could not be
NULL and new maybe_null flag was propagated for IS NULL argument (Item_field)
because table the Item_field belonged to changed its maybe_null status.
Diffstat (limited to 'sql/item.h')
-rw-r--r-- | sql/item.h | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/sql/item.h b/sql/item.h index 0852287cc7f..2b5e867feb7 100644 --- a/sql/item.h +++ b/sql/item.h @@ -1849,9 +1849,14 @@ public: bitmap_fast_test_and_set(tab->read_set, field->field_index); if (field->vcol_info) tab->mark_virtual_col(field); - } + } + } + void update_used_tables() + { + update_table_bitmaps(); + if (field && field->table) + maybe_null= field->maybe_null(); } - void update_used_tables() { update_table_bitmaps(); } Item *get_tmp_table_item(THD *thd); bool collect_item_field_processor(uchar * arg); bool add_field_to_set_processor(uchar * arg); @@ -2874,7 +2879,11 @@ public: enum Item_result result_type () const { return orig_item->result_type(); } enum_field_types field_type() const { return orig_item->field_type(); } table_map used_tables() const { return orig_item->used_tables(); } - void update_used_tables() { orig_item->update_used_tables(); } + void update_used_tables() + { + orig_item->update_used_tables(); + maybe_null= orig_item->maybe_null; + } bool const_item() const { return orig_item->const_item(); } table_map not_null_tables() const { return orig_item->not_null_tables(); } bool walk(Item_processor processor, bool walk_subquery, uchar *arg) @@ -2966,6 +2975,7 @@ public: Item *replace_equal_field(uchar *arg); table_map used_tables() const; table_map not_null_tables() const; + void update_used_tables(); bool walk(Item_processor processor, bool walk_subquery, uchar *arg) { return (*ref)->walk(processor, walk_subquery, arg) || |