From ec7da1561e028aac40dee69433113978c982ce84 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 25 Sep 2013 15:30:13 +0300 Subject: MDEV-5039: incorrect Item_func_regex::update_used_tables() Other fix of maybe_null problem and revert of revno: 3608 "MDEV-3873 & MDEV-3876 & MDEV-3912 : Wrong result (extra rows) with ALL subquery from a MERGE view." --- sql/item_cmpfunc.cc | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'sql/item_cmpfunc.cc') diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index f0069757ee3..a6587fd4c3d 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -1352,7 +1352,7 @@ int Arg_comparator::compare_e_row() void Item_func_truth::fix_length_and_dec() { - set_persist_maybe_null(0); + maybe_null= 0; null_value= 0; decimals= 0; max_length= 1; @@ -1860,8 +1860,7 @@ longlong Item_func_eq::val_int() void Item_func_equal::fix_length_and_dec() { Item_bool_func2::fix_length_and_dec(); - set_persist_maybe_null(0); - null_value= 0; + maybe_null=null_value=0; } longlong Item_func_equal::val_int() @@ -2001,7 +2000,7 @@ void Item_func_interval::fix_length_and_dec() } } } - set_persist_maybe_null(0); + maybe_null= 0; max_length= 2; used_tables_cache|= row->used_tables(); not_null_tables_cache= row->not_null_tables(); @@ -2688,7 +2687,7 @@ void Item_func_nullif::fix_length_and_dec() { Item_bool_func2::fix_length_and_dec(); - set_persist_maybe_null(1); + maybe_null=1; if (args[0]) // Only false if EOM { max_length=args[0]->max_length; @@ -4482,8 +4481,6 @@ void Item_cond::update_used_tables() item->update_used_tables(); used_tables_cache|= item->used_tables(); const_item_cache&= item->const_item(); - if (!persistent_maybe_null && item->maybe_null) - maybe_null= 1; } } @@ -4662,9 +4659,10 @@ longlong Item_is_not_null_test::val_int() */ void Item_is_not_null_test::update_used_tables() { - args[0]->update_used_tables(); if (!args[0]->maybe_null) used_tables_cache= 0; /* is always true */ + else + args[0]->update_used_tables(); } @@ -4947,7 +4945,7 @@ Item_func_regex::fix_fields(THD *thd, Item **ref) int comp_res= regcomp(TRUE); if (comp_res == -1) { // Will always return NULL - set_persist_maybe_null(1); + maybe_null=1; fixed= 1; return FALSE; } @@ -4957,7 +4955,7 @@ Item_func_regex::fix_fields(THD *thd, Item **ref) maybe_null= args[0]->maybe_null; } else - set_persist_maybe_null(1); + maybe_null=1; fixed= 1; return FALSE; } @@ -5866,8 +5864,6 @@ void Item_equal::update_used_tables() item->update_used_tables(); used_tables_cache|= item->used_tables(); const_item_cache&= item->const_item(); - if (!persistent_maybe_null && item->maybe_null) - maybe_null= 1; } } -- cgit v1.2.1