[MDEV-23479] Add a THD* argument to Item_func_or_sum::fix_length_and_dec() Created: 2020-08-14  Updated: 2022-04-25  Resolved: 2022-03-30

Status: Closed
Project: MariaDB Server
Component/s: OTHER
Fix Version/s: 10.9.1

Type: Task Priority: Minor
Reporter: Alexander Barkov Assignee: Rucha Deodhar
Resolution: Fixed Votes: 0
Labels: 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


 Comments   
Comment by Rucha Deodhar [ 2022-01-26 ]

Patch: https://github.com/MariaDB/server/commit/4abcb43f56caadfeee0ebf893d3f815ebc7a6cb2

Comment by Oleksandr Byelkin [ 2022-03-28 ]

OK to push

Comment by Oleksandr Byelkin [ 2022-03-28 ]

OK to push

Generated at Thu Feb 08 09:22:43 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.