diff options
author | Ajo Robert <ajo.robert@oracle.com> | 2018-04-10 00:30:59 +0530 |
---|---|---|
committer | Ajo Robert <ajo.robert@oracle.com> | 2018-04-10 00:30:59 +0530 |
commit | 940b88b686bcf037a36f6e81be4017a07fcf782a (patch) | |
tree | 9e5cd4e35627586bfeb57dda77d73fcd5427a726 /sql | |
parent | d982e717aba67227ec40761a21a4211db91aa0e2 (diff) | |
download | mariadb-git-940b88b686bcf037a36f6e81be4017a07fcf782a.tar.gz |
Bug#27197235 USER VARIABLE + UINON + DECIMAL COLUMN RETURNS
WRONG VALUES
User variables will have the default session collation
associated with it. And a select which uses it as part of a
union may infer the collation while type merging.
This leads to problems when the result is of DECIMAL type.
Setting the appropriate collation of DECIMAL result type
is missing in 5.7 code base.
Added code to set appropriate collation when the result is
of DECIMAL type during Item_type_holder::join_types().
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/item.cc b/sql/item.cc index a37a61453e8..07d64881eeb 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -8266,6 +8266,7 @@ bool Item_type_holder::join_types(THD *thd, Item *item) } if (Field::result_merge_type(fld_type) == DECIMAL_RESULT) { + collation.set_numeric(); decimals= min(max(decimals, item->decimals), DECIMAL_MAX_SCALE); int item_int_part= item->decimal_int_part(); int item_prec = max(prev_decimal_int_part, item_int_part) + decimals; |