diff options
-rw-r--r-- | mysql-test/main/func_hybrid_type.result | 15 | ||||
-rw-r--r-- | mysql-test/main/func_hybrid_type.test | 21 | ||||
-rw-r--r-- | sql/sql_type.cc | 2 |
3 files changed, 37 insertions, 1 deletions
diff --git a/mysql-test/main/func_hybrid_type.result b/mysql-test/main/func_hybrid_type.result index 664a872cf4c..95349ffecb9 100644 --- a/mysql-test/main/func_hybrid_type.result +++ b/mysql-test/main/func_hybrid_type.result @@ -4104,3 +4104,18 @@ c # # End of 10.4 tests # +# +# Start of 10.5 tests +# +# +# MDEV-20332 Wrong UNSIGNED metadata flag returned for COALESCE(unsigned_field,timestamp_field) +# +CREATE TABLE t1 (a INT UNSIGNED, b TIMESTAMP); +SELECT COALESCE(a,b) FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(a,b) 253 19 0 Y 0 39 8 +COALESCE(a,b) +DROP TABLE t1; +# +# End of 10.5 tests +# diff --git a/mysql-test/main/func_hybrid_type.test b/mysql-test/main/func_hybrid_type.test index 71536339b4b..93720bcde2e 100644 --- a/mysql-test/main/func_hybrid_type.test +++ b/mysql-test/main/func_hybrid_type.test @@ -815,3 +815,24 @@ SELECT 0 + LEAST(TIME'-10:00:00',TIME'10:00:00') AS c; --echo # --echo # End of 10.4 tests --echo # + + +--echo # +--echo # Start of 10.5 tests +--echo # + +--echo # +--echo # MDEV-20332 Wrong UNSIGNED metadata flag returned for COALESCE(unsigned_field,timestamp_field) +--echo # + +CREATE TABLE t1 (a INT UNSIGNED, b TIMESTAMP); +--disable_ps_protocol +--enable_metadata +SELECT COALESCE(a,b) FROM t1; +--disable_metadata +--enable_ps_protocol +DROP TABLE t1; + +--echo # +--echo # End of 10.5 tests +--echo # diff --git a/sql/sql_type.cc b/sql/sql_type.cc index 7265bdd2cee..462aebe0962 100644 --- a/sql/sql_type.cc +++ b/sql/sql_type.cc @@ -1201,7 +1201,7 @@ bool Type_std_attributes::aggregate_attributes_string(const char *func_name, max_length= find_max_octet_length(items, nitems); else fix_char_length(find_max_char_length(items, nitems)); - unsigned_flag= count_unsigned(items, nitems) > 0; + unsigned_flag= false; decimals= max_length ? NOT_FIXED_DEC : 0; return false; } |