summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <jimw@mysql.com>2005-10-28 10:17:37 -0700
committerunknown <jimw@mysql.com>2005-10-28 10:17:37 -0700
commitac8b32f9c07368e4d38a0ecd0564645483ef9295 (patch)
tree4a8f11c1cd5a4c4c5c9debdf8517b4226a7fac50
parentfbb2fd3e581170dca52c1f92a2474312423f66f4 (diff)
parentc606f921a4baa57c80885c2155d93c94004d41a8 (diff)
downloadmariadb-git-ac8b32f9c07368e4d38a0ecd0564645483ef9295.tar.gz
Merge bk-internal:/home/bk/mysql-5.0
into mysql.com:/home/jimw/my/mysql-5.0-clean sql/item_func.cc: Auto merged
-rw-r--r--mysql-test/r/func_math.result6
-rw-r--r--mysql-test/r/type_newdecimal.result2
-rw-r--r--mysql-test/t/func_math.test10
-rw-r--r--sql/item_func.cc1
4 files changed, 18 insertions, 1 deletions
diff --git a/mysql-test/r/func_math.result b/mysql-test/r/func_math.result
index b7ba2273956..fba274b9bb1 100644
--- a/mysql-test/r/func_math.result
+++ b/mysql-test/r/func_math.result
@@ -170,6 +170,12 @@ insert into t1 values (1);
select rand(i) from t1;
ERROR HY000: Incorrect arguments to RAND
drop table t1;
+create table t1 (a varchar(90), ts datetime not null, index (a)) engine=innodb default charset=utf8;
+insert into t1 values ('http://www.foo.com/', now());
+select a from t1 where a='http://www.foo.com/' order by abs(timediff(ts, 0));
+a
+http://www.foo.com/
+drop table t1;
set sql_mode='traditional';
select ln(-1);
ln(-1)
diff --git a/mysql-test/r/type_newdecimal.result b/mysql-test/r/type_newdecimal.result
index dbae646c362..45eb8aab89e 100644
--- a/mysql-test/r/type_newdecimal.result
+++ b/mysql-test/r/type_newdecimal.result
@@ -176,7 +176,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`round(15.4,-1)` decimal(3,0) unsigned NOT NULL default '0',
`truncate(-5678.123451,-3)` decimal(4,0) NOT NULL default '0',
- `abs(-1.1)` decimal(2,1) NOT NULL default '0.0',
+ `abs(-1.1)` decimal(2,1) default NULL,
`-(-1.1)` decimal(2,1) NOT NULL default '0.0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
diff --git a/mysql-test/t/func_math.test b/mysql-test/t/func_math.test
index 2935f24f2d7..24dd18daab1 100644
--- a/mysql-test/t/func_math.test
+++ b/mysql-test/t/func_math.test
@@ -116,6 +116,16 @@ insert into t1 values (1);
select rand(i) from t1;
drop table t1;
+#
+# Bug #14009: use of abs() on null value causes problems with filesort
+#
+# InnoDB is required to reproduce the fault, but it is okay if we default to
+# MyISAM when testing.
+create table t1 (a varchar(90), ts datetime not null, index (a)) engine=innodb default charset=utf8;
+insert into t1 values ('http://www.foo.com/', now());
+select a from t1 where a='http://www.foo.com/' order by abs(timediff(ts, 0));
+drop table t1;
+
# End of 4.1 tests
#
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 9c1d1f63635..df25c3c97fa 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -636,6 +636,7 @@ void Item_func_num1::fix_num_length_and_dec()
{
decimals= args[0]->decimals;
max_length= args[0]->max_length;
+ maybe_null= 1;
}