From c8e797b5b6d921803746d82b81c5e9e35d7c03a6 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 2 Jun 2005 17:00:07 +0400 Subject: 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. --- mysql-test/r/func_if.result | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'mysql-test/r/func_if.result') diff --git a/mysql-test/r/func_if.result b/mysql-test/r/func_if.result index 4db31121756..3e72fb45a14 100644 --- a/mysql-test/r/func_if.result +++ b/mysql-test/r/func_if.result @@ -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; -- cgit v1.2.1