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 /mysql-test | |
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 'mysql-test')
-rw-r--r-- | mysql-test/r/union.result | 16 | ||||
-rw-r--r-- | mysql-test/t/union.test | 14 |
2 files changed, 30 insertions, 0 deletions
diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result index 97c1a8b4d49..c0b364d0fde 100644 --- a/mysql-test/r/union.result +++ b/mysql-test/r/union.result @@ -1860,3 +1860,19 @@ DROP TABLE t17059925, t2, t3; SET @@long_query_time= @old_long_query_time; SET @@global.log_output= @old_log_output; SET @@global.slow_query_log= @old_slow_query_log; +# +# Bug#27197235 USER VARIABLE + UINON + DECIMAL COLUMN RETURNS +# WRONG VALUES +# +SET NAMES utf8; +SET @advertAcctId = 1000003; +select @advertAcctId as a from dual union all select 1.0 from dual; +a +1000003.0 +1.0 +SET NAMES latin1; +SET @advertAcctId = 1000003; +select @advertAcctId as a from dual union all select 1.0 from dual; +a +1000003.0 +1.0 diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test index 147c1d3834b..d7e362558e3 100644 --- a/mysql-test/t/union.test +++ b/mysql-test/t/union.test @@ -1256,3 +1256,17 @@ SET @@long_query_time= @old_long_query_time; SET @@global.log_output= @old_log_output; SET @@global.slow_query_log= @old_slow_query_log; +--echo # +--echo # Bug#27197235 USER VARIABLE + UINON + DECIMAL COLUMN RETURNS +--echo # WRONG VALUES +--echo # + +let $old_charset= `SELECT @@character_set_client`; + +SET NAMES utf8; +SET @advertAcctId = 1000003; +select @advertAcctId as a from dual union all select 1.0 from dual; + +eval SET NAMES $old_charset; +SET @advertAcctId = 1000003; +select @advertAcctId as a from dual union all select 1.0 from dual; |