diff options
author | ramil/ram@mysql.com/ramil.myoffice.izhnet.ru <> | 2007-10-29 12:20:21 +0400 |
---|---|---|
committer | ramil/ram@mysql.com/ramil.myoffice.izhnet.ru <> | 2007-10-29 12:20:21 +0400 |
commit | 98a4d99961eae8c3a224739099fc95544ff2b43d (patch) | |
tree | e9112ce10721f2b915b8376caddb5001056b04b1 /mysql-test/t/case.test | |
parent | 3d203e55e67946e505f85a7d3a4321794ece51fe (diff) | |
download | mariadb-git-98a4d99961eae8c3a224739099fc95544ff2b43d.tar.gz |
Fix for bug #30782: Truncated UNSIGNED BIGINT columns only in SELECT w/ CASE,
JOIN, and ORDER BY
Problem: improper maximum length calculation of the CASE function leads to
decimal value truncation (storing/retrieving decimal field values).
Fix: accurately calculate maximum length/unsigned flag/decimals parameters
of the CASE function.
Diffstat (limited to 'mysql-test/t/case.test')
-rw-r--r-- | mysql-test/t/case.test | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/mysql-test/t/case.test b/mysql-test/t/case.test index 0e9e141f6d8..b6654df4ecb 100644 --- a/mysql-test/t/case.test +++ b/mysql-test/t/case.test @@ -3,7 +3,7 @@ # --disable_warnings -drop table if exists t1; +drop table if exists t1, t2; --enable_warnings select CASE "b" when "a" then 1 when "b" then 2 END; @@ -152,4 +152,21 @@ SELECT IFNULL(t2.EMPNUM,t1.EMPNUM) AS CEMPNUM, FROM t1 LEFT JOIN t2 ON t1.EMPNUM=t2.EMPNUM; DROP TABLE t1,t2; -# End of 4.1 tests + +--echo End of 4.1 tests + +# +# #30782: Truncated UNSIGNED BIGINT columns +# +create table t1 (a int, b bigint unsigned); +create table t2 (c int); +insert into t1 (a, b) values (1,4572794622775114594), (2,18196094287899841997), + (3,11120436154190595086); +insert into t2 (c) values (1), (2), (3); +select t1.a, (case t1.a when 0 then 0 else t1.b end) d from t1 + join t2 on t1.a=t2.c order by d; +select t1.a, (case t1.a when 0 then 0 else t1.b end) d from t1 + join t2 on t1.a=t2.c where b=11120436154190595086 order by d; +drop table t1, t2; + +--echo End of 5.0 tests |