Below is the list of changes that have just been committed into a local
5.0 repository of evgen. When evgen does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.1944 05/05/13 14:57:37 evgen@stripped +3 -0
Fix bug #9669 Ordering on IF function with FROM_UNIXTIME function fails
Integer overflow results in wrong field sortlength.
mysql-test/r/func_if.result
1.18 05/05/13 14:45:37 evgen@stripped +17 -0
Test for bug #9669 Ordering on IF function with FROM_UNIXTIME function fails.
mysql-test/t/func_if.test
1.12 05/05/13 14:44:54 evgen@stripped +14 -0
Test for bug #9669 Ordering on IF function with FROM_UNIXTIME function fails.
sql/item_cmpfunc.cc
1.146 05/05/13 14:24:35 evgen@stripped +8 -1
Fix bug #9669 Ordering on IF function with FROM_UNIXTIME function fails.
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: evgen
# Host: moonbone.local
# Root: /usr/src/mysql-5.0-bug-9669
--- 1.145/sql/item_cmpfunc.cc 2005-05-06 14:46:01 +04:00
+++ 1.146/sql/item_cmpfunc.cc 2005-05-13 14:24:35 +04:00
@@ -1225,9 +1225,16 @@
{
maybe_null=args[1]->maybe_null || args[2]->maybe_null;
decimals= max(args[1]->decimals, args[2]->decimals);
- max_length= (max(args[1]->max_length - args[1]->decimals,
+ if (decimals == NOT_FIXED_DEC)
+ {
+ max_length= max(args[1]->max_length, args[2]->max_length);
+ }
+ else
+ {
+ max_length= (max(args[1]->max_length - args[1]->decimals,
args[2]->max_length - args[2]->decimals) +
decimals);
+ }
enum Item_result arg1_type=args[1]->result_type();
enum Item_result arg2_type=args[2]->result_type();
bool null1=args[1]->const_item() && args[1]->null_value;
--- 1.17/mysql-test/r/func_if.result 2005-04-01 16:04:43 +04:00
+++ 1.18/mysql-test/r/func_if.result 2005-05-13 14:45:37 +04:00
@@ -91,3 +91,20 @@
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;
--- 1.11/mysql-test/t/func_if.test 2005-04-01 16:04:44 +04:00
+++ 1.12/mysql-test/t/func_if.test 2005-05-13 14:44:54 +04:00
@@ -61,3 +61,17 @@
# 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;
+
| Thread |
|---|
| • bk commit into 5.0 tree (evgen:1.1944) BUG#9669 | eugene | 13 May |