diff options
| author | Alexander Barkov <bar@mariadb.com> | 2019-04-27 08:44:29 +0400 |
|---|---|---|
| committer | Alexander Barkov <bar@mariadb.com> | 2019-04-27 08:44:29 +0400 |
| commit | f239fd5034fe66a06a7a254fe1721eae781b118e (patch) | |
| tree | 7b7e8f089dccd7e58c57f4d3ef1a6ec101de36ae /sql | |
| parent | 5fe0087a7234bb0b1304c8aeb010e00eca5cce5c (diff) | |
| download | mariadb-git-f239fd5034fe66a06a7a254fe1721eae781b118e.tar.gz | |
MDEV-11015 Assertion failed: precision > 0 in decimal_bin_size upon SELECT with DISTINCT, CAST and other functions
Item_func_min_max::fix_length_and_dec() erroneously set max_length
to UINT32_MAX.
Merge notes:
In 10.3 this problem had been fixed earlier.
During merge to 10.3, do a "null merge" in item_func.cc
Diffstat (limited to 'sql')
| -rw-r--r-- | sql/item_func.cc | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc index a1a2c3f1d1c..86111374175 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -2793,6 +2793,7 @@ void Item_func_min_max::fix_length_and_dec() switch (tmp_cmp_type) { case TIME_RESULT: + { // At least one temporal argument was found. if (temporal_type_count < arg_count) maybe_null= true; // Non-temporal-to-temporal conversion can return NULL @@ -2802,8 +2803,11 @@ void Item_func_min_max::fix_length_and_dec() set_if_smaller(decimals, TIME_SECOND_PART_DIGITS); else decimals= 0; + uint len= decimals ? (decimals + 1) : 0; + len+= mysql_temporal_int_part_length(temporal_field_type); + fix_char_length(len); break; - + } case STRING_RESULT: /* All arguments are of string-alike types: |
