List:Commits« Previous MessageNext Message »
From:ramil Date:September 8 2006 4:03pm
Subject:bk commit into 4.1 tree (ramil:1.2540) BUG#20204
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of ram. When ram 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, 2006-09-08 19:02:54+05:00, ramil@stripped +3 -0
  Fix for bug #20204: "order by" changes the results returned
  
  Item_substr's results are improperly stored in a temporary table due to
  wrongly calculated max_length value for multi-byte charsets if two
  arguments specified.

  mysql-test/r/ctype_utf8.result@stripped, 2006-09-08 19:02:49+05:00, ramil@stripped +12 -0
    Fix for bug #20204: "order by" changes the results returned
      - test result.

  mysql-test/t/ctype_utf8.test@stripped, 2006-09-08 19:02:49+05:00, ramil@stripped +12 -0
    Fix for bug #20204: "order by" changes the results returned
      - test case.

  sql/item_strfunc.cc@stripped, 2006-09-08 19:02:49+05:00, ramil@stripped +2 -1
    Fix for bug #20204: "order by" changes the results returned
      - always take into account current mbmaxlen value calculating max_length.

# 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:	ramil
# Host:	myoffice.izhnet.ru
# Root:	/usr/home/ram/work/bug20204/my41-bug20204

--- 1.246/sql/item_strfunc.cc	2006-09-08 19:03:01 +05:00
+++ 1.247/sql/item_strfunc.cc	2006-09-08 19:03:01 +05:00
@@ -1104,12 +1104,13 @@
   }
   if (arg_count == 3 && args[2]->const_item())
   {
-    int32 length= (int32) args[2]->val_int() * collation.collation->mbmaxlen;
+    int32 length= (int32) args[2]->val_int();
     if (length <= 0)
       max_length=0; /* purecov: inspected */
     else
       set_if_smaller(max_length,(uint) length);
   }
+  max_length*= collation.collation->mbmaxlen;
 }
 
 

--- 1.73/mysql-test/r/ctype_utf8.result	2006-09-08 19:03:01 +05:00
+++ 1.74/mysql-test/r/ctype_utf8.result	2006-09-08 19:03:01 +05:00
@@ -1293,3 +1293,15 @@
 42749	72	VOLNÝ ADSL
 44205	72	VOLNÝ ADSL
 DROP TABLE t1;
+create table t1(a char(10)) default charset utf8;
+insert into t1 values ('123'), ('456');
+explain
+select substr(Z.a,-1), Z.a from t1 as Y join t1 as Z on Y.a=Z.a order by 1;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	Y	ALL	NULL	NULL	NULL	NULL	2	Using temporary; Using filesort
+1	SIMPLE	Z	ALL	NULL	NULL	NULL	NULL	2	Using where
+select substr(Z.a,-1), Z.a from t1 as Y join t1 as Z on Y.a=Z.a order by 1;
+substr(Z.a,-1)	a
+3	123
+6	456
+drop table t1;

--- 1.75/mysql-test/t/ctype_utf8.test	2006-09-08 19:03:01 +05:00
+++ 1.76/mysql-test/t/ctype_utf8.test	2006-09-08 19:03:01 +05:00
@@ -1040,4 +1040,16 @@
 SELECT * FROM t1 WHERE tid=72 and val LIKE 'VOLNÝ ADSL'; 
 
 DROP TABLE t1;
+
+#
+# Bug #20204: substr(s, p) returns empty strings
+#
+
+create table t1(a char(10)) default charset utf8;
+insert into t1 values ('123'), ('456');
+explain
+  select substr(Z.a,-1), Z.a from t1 as Y join t1 as Z on Y.a=Z.a order by 1;
+select substr(Z.a,-1), Z.a from t1 as Y join t1 as Z on Y.a=Z.a order by 1;
+drop table t1;
+
 # End of 4.1 tests
Thread
bk commit into 4.1 tree (ramil:1.2540) BUG#20204ramil8 Sep