List:Commits« Previous MessageNext Message »
From:bar Date:March 17 2008 12:12pm
Subject:bk commit into 6.0 tree (bar:1.2597) BUG#33663
View as plain text  
Below is the list of changes that have just been committed into a local
6.0 repository of bar.  When bar 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@stripped, 2008-03-17 16:12:11+04:00, bar@stripped +3 -0
  Bug#33663 Character sets: weight_string function, varchar column, wrong result
  Problem: null_value was checked before calling val_str(),
  so null_value corresponded NULL flag for the previous row.
  Fix: check null_value after calling val_str().

  mysql-test/r/func_weight_string.result@stripped, 2008-03-17 16:12:08+04:00, bar@stripped +7 -0
    Adding test case

  mysql-test/t/func_weight_string.test@stripped, 2008-03-17 16:12:08+04:00, bar@stripped +9 -0
    Adding test case

  sql/item_strfunc.cc@stripped, 2008-03-17 16:12:08+04:00, bar@stripped +3 -3
    Checking null_value after calling val_str()

diff -Nrup a/mysql-test/r/func_weight_string.result b/mysql-test/r/func_weight_string.result
--- a/mysql-test/r/func_weight_string.result	2007-04-03 16:16:12 +05:00
+++ b/mysql-test/r/func_weight_string.result	2008-03-17 16:12:08 +04:00
@@ -69,3 +69,10 @@ coercibility(weight_string('test'))
 select coercibility(weight_string('test' collate latin1_swedish_ci));
 coercibility(weight_string('test' collate latin1_swedish_ci))
 0
+create table t1 (s1 varchar(5));
+insert into t1 values ('a'),(null);
+select hex(weight_string(s1)) from t1 order by s1;
+hex(weight_string(s1))
+NULL
+41
+drop table t1;
diff -Nrup a/mysql-test/t/func_weight_string.test b/mysql-test/t/func_weight_string.test
--- a/mysql-test/t/func_weight_string.test	2007-04-03 16:16:12 +05:00
+++ b/mysql-test/t/func_weight_string.test	2008-03-17 16:12:08 +04:00
@@ -95,3 +95,12 @@ select 1 as weight_string, 2 as reverse;
 #
 select coercibility(weight_string('test'));
 select coercibility(weight_string('test' collate latin1_swedish_ci));
+
+#
+# Bug#33663 Character sets: weight_string function,
+# varchar column, wrong result
+#
+create table t1 (s1 varchar(5));
+insert into t1 values ('a'),(null);
+select hex(weight_string(s1)) from t1 order by s1;
+drop table t1;
diff -Nrup a/sql/item_strfunc.cc b/sql/item_strfunc.cc
--- a/sql/item_strfunc.cc	2008-02-22 15:05:07 +04:00
+++ b/sql/item_strfunc.cc	2008-03-17 16:12:08 +04:00
@@ -2979,9 +2979,9 @@ String *Item_func_weight_string::val_str
   uint tmp_length, frm_length;
   DBUG_ASSERT(fixed == 1);
 
-  if (args[0]->null_value ||
-      args[0]->result_type() != STRING_RESULT ||
-      !(res= args[0]->val_str(str)))
+  if (args[0]->result_type() != STRING_RESULT ||
+      !(res= args[0]->val_str(str)) ||
+      args[0]->null_value)
     goto nl;
   
   tmp_length= cs->coll->strnxfrmlen(cs, cs->mbmaxlen *
Thread
bk commit into 6.0 tree (bar:1.2597) BUG#33663bar17 Mar
  • Re: bk commit into 6.0 tree (bar:1.2597) BUG#33663Davi Arnaut18 Mar