diff options
author | Georgi Kodinov <Georgi.Kodinov@Oracle.com> | 2010-12-08 16:05:26 +0200 |
---|---|---|
committer | Georgi Kodinov <Georgi.Kodinov@Oracle.com> | 2010-12-08 16:05:26 +0200 |
commit | 3190d454236c73184b41dcbd7a296069ac2d115b (patch) | |
tree | adc7506d38ae950d3be869e8f23207c86715472c /sql | |
parent | a4b106c882d56516b0f9c01b54432608a30577c8 (diff) | |
download | mariadb-git-3190d454236c73184b41dcbd7a296069ac2d115b.tar.gz |
Backport of the 5.1 fix for bug #55826 to 5.0
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item_func.cc | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc index 6cd8f34ecef..3d105a159e0 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -2270,7 +2270,7 @@ void Item_func_min_max::fix_length_and_dec() stored to the value pointer, if latter is provided. RETURN - 0 If one of arguments is NULL + 0 If one of arguments is NULL or there was a execution error # index of the least/greatest argument */ @@ -2284,6 +2284,14 @@ uint Item_func_min_max::cmp_datetimes(ulonglong *value) Item **arg= args + i; bool is_null; longlong res= get_datetime_value(thd, &arg, 0, datetime_item, &is_null); + + /* Check if we need to stop (because of error or KILL) and stop the loop */ + if (thd->net.report_error) + { + null_value= 1; + return 0; + } + if ((null_value= args[i]->null_value)) return 0; if (i == 0 || (res < min_max ? cmp_sign : -cmp_sign) > 0) @@ -2312,6 +2320,12 @@ String *Item_func_min_max::val_str(String *str) if (null_value) return 0; str_res= args[min_max_idx]->val_str(str); + if (args[min_max_idx]->null_value) + { + // check if the call to val_str() above returns a NULL value + null_value= 1; + return NULL; + } str_res->set_charset(collation.collation); return str_res; } |