Details
-
Task
-
Status: Closed (View Workflow)
-
Minor
-
Resolution: Fixed
-
None
Description
Let's add a THD * parameter to Item_func_or_sum::fix_length_and_dec().
We use current_thd frequently in fix_length_and_dec():
For certain data types, like TIME/DATETIME/DATE, THD is needed in the majority of Item_func_xxx, because they need access to thd->variables.sql_mode, for:
- MODE_TIME_ROUND_FRACTIONAL
- MODE_NO_ZERO_DATE
- MODE_NO_ZERO_IN_DATE
All hybrid type functions also need thd for the same reason (when returning TIME/DATETIME/DATE).
Also, the following sql_mode flags are tested in fix_length_and_dec():
- MODE_NO_UNSIGNED_SUBTRACTION
Many functions access THD in fix_length_and_dec() for other reasons than sql_mode:
- Item_bool_rowready_func2, directly, as well as when installing Arg_comparator
- Item_func_interval
- Item_func_between
- Item_func_nullif
- Item_func_case_searched
- Item_func_case_simple
- Item_func_decode_oracle
- Item_func_in, directly, and when installing in_vector and cmp_item_xxx()
- Item_func_regex, when installing Regexp_processor_pcre
- Item_equal
- Item_hybrid_func, in fix_attributes()
- Item_func_div
- Item_func_min_max, in fix_attributes()
- Item_func_get_user_var
- Item_func_get_system_var
- Item_func_json_array
- Item_func_sha2
- Item_singlerow_subselect
- Item_sum_avg
- Item_sum_variance
- Item_func_monthname
- Item_func_dayname
- Item_func_date_format
- Item_func_from_unixtime
- Item_char_typecast
- Item_func_time_to_sec
- Item_func_convert_tz
- Item_extract
- Item_func_timestamp
- Item_func_timediff
- Item_func_date_add_interval
- Item_func_add_time