1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-8871 Wrong result for CREATE TABLE .. SELECT LEAST(unsigned_column,unsigned_column)

This commit is contained in:
Alexander Barkov
2015-09-30 10:05:16 +04:00
parent c13f4091f5
commit 09b87d6293
3 changed files with 80 additions and 2 deletions

View File

@ -377,5 +377,44 @@ id k c pad
7 16 a xxx
DROP TABLE t1;
#
# MDEV-8871 Wrong result for CREATE TABLE .. SELECT LEAST(unsigned_column,unsigned_column)
#
CREATE TABLE t1 (a INT,b INT UNSIGNED);
INSERT INTO t1 VALUES (-2147483648,4294967295);
SELECT a, b, LEAST(a,a), LEAST(b,b), LEAST(a,b), LEAST(b,a), GREATEST(a,b), GREATEST(b,a) FROM t1;
a -2147483648
b 4294967295
LEAST(a,a) -2147483648
LEAST(b,b) 4294967295
LEAST(a,b) -2147483648
LEAST(b,a) -2147483648
GREATEST(a,b) 4294967295
GREATEST(b,a) 4294967295
CREATE TABLE t2 AS
SELECT a, b, LEAST(a,a), LEAST(b,b), LEAST(a,b), LEAST(b,a), GREATEST(a,b), GREATEST(b,a) FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` int(11) DEFAULT NULL,
`b` int(10) unsigned DEFAULT NULL,
`LEAST(a,a)` int(11) DEFAULT NULL,
`LEAST(b,b)` int(10) unsigned DEFAULT NULL,
`LEAST(a,b)` decimal(10,0) DEFAULT NULL,
`LEAST(b,a)` decimal(10,0) DEFAULT NULL,
`GREATEST(a,b)` decimal(10,0) DEFAULT NULL,
`GREATEST(b,a)` decimal(10,0) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT * FROM t2;
a -2147483648
b 4294967295
LEAST(a,a) -2147483648
LEAST(b,b) 4294967295
LEAST(a,b) -2147483648
LEAST(b,a) -2147483648
GREATEST(a,b) 4294967295
GREATEST(b,a) 4294967295
DROP TABLE t2;
DROP TABLE t1;
#
# End of 10.1 tests
#