Below is the list of changes that have just been committed into a local
4.1 repository of jimw. When jimw 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.2304 05/05/31 17:12:50 jimw@stripped +3 -0
Fix handling of NULL fields in FIELD(). (Bug #10944)
sql/item_func.cc
1.246 05/05/31 17:12:47 jimw@stripped +6 -5
Fix handle of NULL arguments to FIELD()
mysql-test/t/func_str.test
1.72 05/05/31 17:12:47 jimw@stripped +5 -0
Add regression test
mysql-test/r/func_str.result
1.91 05/05/31 17:12:47 jimw@stripped +3 -0
Add new results
# 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: jimw
# Host: rama.(none)
# Root: /home/jimw/my/mysql-4.1-10944
--- 1.245/sql/item_func.cc 2005-05-26 03:09:09 -07:00
+++ 1.246/sql/item_func.cc 2005-05-31 17:12:47 -07:00
@@ -1496,7 +1496,8 @@
for (uint i=1 ; i < arg_count ; i++)
{
String *tmp_value=args[i]->val_str(&tmp);
- if (tmp_value && !sortcmp(field,tmp_value,cmp_collation.collation))
+ if (tmp_value && !args[i]->null_value &&
+ !sortcmp(field,tmp_value,cmp_collation.collation))
return (longlong) (i);
}
}
@@ -1505,8 +1506,8 @@
longlong val= args[0]->val_int();
for (uint i=1; i < arg_count ; i++)
{
- if (val == args[i]->val_int())
- return (longlong) (i);
+ if (!args[i]->null_value && val == args[i]->val_int())
+ return (longlong) (i);
}
}
else
@@ -1514,8 +1515,8 @@
double val= args[0]->val();
for (uint i=1; i < arg_count ; i++)
{
- if (val == args[i]->val())
- return (longlong) (i);
+ if (!args[i]->null_value && val == args[i]->val())
+ return (longlong) (i);
}
}
return 0;
--- 1.90/mysql-test/r/func_str.result 2005-03-24 06:08:03 -08:00
+++ 1.91/mysql-test/r/func_str.result 2005-05-31 17:12:47 -07:00
@@ -783,3 +783,6 @@
1 foo
2 NULL
DROP TABLE t1, t2;
+select field(0,NULL,1,0), field("",NULL,"bar",""), field(0.0,NULL,1.0,0.0);
+field(0,NULL,1,0) field("",NULL,"bar","") field(0.0,NULL,1.0,0.0)
+3 3 3
--- 1.71/mysql-test/t/func_str.test 2005-03-24 06:08:03 -08:00
+++ 1.72/mysql-test/t/func_str.test 2005-05-31 17:12:47 -07:00
@@ -521,3 +521,8 @@
DROP TABLE t1, t2;
+
+#
+# Bug #10944: Mishandling of NULL arguments in FIELD()
+#
+select field(0,NULL,1,0), field("",NULL,"bar",""), field(0.0,NULL,1.0,0.0);
| Thread |
|---|
| • bk commit into 4.1 tree (jimw:1.2304) BUG#10944 | Jim Winstead | 1 Jun |