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_strfunc.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_strfunc.h')
-rw-r--r-- | sql/item_strfunc.h | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index fc4e888e6ea..e3b040a2e55 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -319,7 +319,7 @@ public: String *val_str(String *); void fix_length_and_dec() { - maybe_null=1; + set_persist_maybe_null(1); /* 9 = MAX ((8- (arg_len % 8)) + 1) */ max_length = args[0]->max_length + 9; } @@ -335,7 +335,7 @@ public: String *val_str(String *); void fix_length_and_dec() { - maybe_null=1; + set_persist_maybe_null(1); /* 9 = MAX ((8- (arg_len % 8)) + 1) */ max_length = args[0]->max_length - 9; } @@ -361,7 +361,7 @@ public: constructor_helper(); } String *val_str(String *); - void fix_length_and_dec() { maybe_null=1; max_length = 13; } + void fix_length_and_dec() { set_persist_maybe_null(1); max_length = 13; } const char *func_name() const { return "encrypt"; } bool check_vcol_func_processor(uchar *int_arg) { @@ -431,7 +431,7 @@ public: void fix_length_and_dec() { max_length= MAX_FIELD_NAME * system_charset_info->mbmaxlen; - maybe_null=1; + set_persist_maybe_null(1); } const char *func_name() const { return "database"; } const char *fully_qualified_func_name() const { return "database()"; } @@ -607,7 +607,7 @@ public: { collation.set(default_charset()); max_length=64; - maybe_null= 1; + set_persist_maybe_null(1); } }; @@ -634,7 +634,7 @@ public: Item_func_unhex(Item *a) :Item_str_func(a) { /* there can be bad hex strings */ - maybe_null= 1; + set_persist_maybe_null(1); } const char *func_name() const { return "unhex"; } String *val_str(String *); @@ -680,7 +680,7 @@ public: void fix_length_and_dec() { collation.set(&my_charset_bin, DERIVATION_COERCIBLE); - maybe_null=1; + set_persist_maybe_null(1); max_length=MAX_BLOB_WIDTH; } bool check_vcol_func_processor(uchar *int_arg) @@ -713,7 +713,7 @@ public: { decimals= 0; max_length= 3 * 8 + 7; - maybe_null= 1; + set_persist_maybe_null(1); } }; @@ -804,7 +804,7 @@ public: { collation.set(system_charset_info); max_length= 64 * collation.collation->mbmaxlen; // should be enough - maybe_null= 0; + set_persist_maybe_null(0); }; table_map not_null_tables() const { return 0; } }; @@ -819,7 +819,7 @@ public: { collation.set(system_charset_info); max_length= 64 * collation.collation->mbmaxlen; // should be enough - maybe_null= 0; + set_persist_maybe_null(0); }; table_map not_null_tables() const { return 0; } }; @@ -865,7 +865,8 @@ class Item_func_uncompress: public Item_str_func String buffer; public: Item_func_uncompress(Item *a): Item_str_func(a){} - void fix_length_and_dec(){ maybe_null= 1; max_length= MAX_BLOB_WIDTH; } + void fix_length_and_dec() + { set_persist_maybe_null(1); max_length= MAX_BLOB_WIDTH; } const char *func_name() const{return "uncompress";} String *val_str(String *) ZLIB_DEPENDED_FUNCTION }; @@ -937,7 +938,7 @@ public: max_length= MAX_DYNAMIC_COLUMN_LENGTH; } void fix_length_and_dec() - { maybe_null= 1; } + { set_persist_maybe_null(1); } /* Mark that collation can change between calls */ bool dynamic_result() { return 1; } @@ -956,7 +957,8 @@ class Item_func_dyncol_list: public Item_str_func { public: Item_func_dyncol_list(Item *str) :Item_str_func(str) {}; - void fix_length_and_dec() { maybe_null= 1; max_length= MAX_BLOB_WIDTH; }; + void fix_length_and_dec() + { set_persist_maybe_null(1); max_length= MAX_BLOB_WIDTH; }; const char *func_name() const{ return "column_list"; } String *val_str(String *); }; |