mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Fix bug #9669 Ordering on IF function with FROM_UNIXTIME function fails
Integer overflow results in wrong field sortlength. sql/item_cmpfunc.cc: Fix bug #9669 Ordering on IF function with FROM_UNIXTIME function fails. mysql-test/t/func_if.test: Test for bug #9669 Ordering on IF function with FROM_UNIXTIME function fails. mysql-test/r/func_if.result: Test for bug #9669 Ordering on IF function with FROM_UNIXTIME function fails.
This commit is contained in:
@ -91,3 +91,20 @@ drop table t1;
|
||||
SELECT NULLIF(5,5) IS NULL, NULLIF(5,5) IS NOT NULL;
|
||||
NULLIF(5,5) IS NULL NULLIF(5,5) IS NOT NULL
|
||||
1 0
|
||||
CREATE TABLE `t1` (
|
||||
`id` int(11) NOT NULL ,
|
||||
`date` int(10) default NULL,
|
||||
`text` varchar(32) NOT NULL
|
||||
);
|
||||
INSERT INTO t1 VALUES (1,1110000000,'Day 1'),(2,1111000000,'Day 2'),(3,1112000000,'Day 3');
|
||||
SELECT id, IF(date IS NULL, '-', FROM_UNIXTIME(date, '%d-%m-%Y')) AS date_ord, text FROM t1 ORDER BY date_ord ASC;
|
||||
id date_ord text
|
||||
1 05-03-2005 Day 1
|
||||
2 16-03-2005 Day 2
|
||||
3 28-03-2005 Day 3
|
||||
SELECT id, IF(date IS NULL, '-', FROM_UNIXTIME(date, '%d-%m-%Y')) AS date_ord, text FROM t1 ORDER BY date_ord DESC;
|
||||
id date_ord text
|
||||
3 28-03-2005 Day 3
|
||||
2 16-03-2005 Day 2
|
||||
1 05-03-2005 Day 1
|
||||
DROP TABLE t1;
|
||||
|
@ -61,3 +61,17 @@ drop table t1;
|
||||
# Bug #5595 NULLIF() IS NULL returns false if NULLIF() returns NULL
|
||||
#
|
||||
SELECT NULLIF(5,5) IS NULL, NULLIF(5,5) IS NOT NULL;
|
||||
|
||||
#
|
||||
# Bug #9669 Ordering on IF function with FROM_UNIXTIME function fails
|
||||
#
|
||||
CREATE TABLE `t1` (
|
||||
`id` int(11) NOT NULL ,
|
||||
`date` int(10) default NULL,
|
||||
`text` varchar(32) NOT NULL
|
||||
);
|
||||
INSERT INTO t1 VALUES (1,1110000000,'Day 1'),(2,1111000000,'Day 2'),(3,1112000000,'Day 3');
|
||||
SELECT id, IF(date IS NULL, '-', FROM_UNIXTIME(date, '%d-%m-%Y')) AS date_ord, text FROM t1 ORDER BY date_ord ASC;
|
||||
SELECT id, IF(date IS NULL, '-', FROM_UNIXTIME(date, '%d-%m-%Y')) AS date_ord, text FROM t1 ORDER BY date_ord DESC;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
Reference in New Issue
Block a user