List:Commits« Previous MessageNext Message »
From:kgeorge Date:March 11 2007 8:12am
Subject:bk commit into 5.1 tree (gkodinov:1.2478)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of kgeorge. When kgeorge 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, 2007-03-11 10:12:34+02:00, gkodinov@stripped +3 -0
  Merge gkodinov@stripped:/home/bk/mysql-5.1-opt
  into  magare.gmz:/home/kgeorge/mysql/autopush/WL3527-5.0-opt-merge-5.1-opt
  MERGE: 1.2475.1.1

  mysql-test/r/func_str.result@stripped, 2007-03-11 10:11:06+02:00, gkodinov@stripped +0 -0
    Auto merged
    MERGE: 1.139.1.1

  mysql-test/t/func_str.test@stripped, 2007-03-11 10:12:27+02:00, gkodinov@stripped +1 -0
    MERGE: 1.105.1.1

  sql/item_strfunc.cc@stripped, 2007-03-11 10:11:06+02:00, gkodinov@stripped +0 -0
    Auto merged
    MERGE: 1.313.1.1

# 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:	gkodinov
# Host:	magare.gmz
# Root:	/home/kgeorge/mysql/autopush/WL3527-5.0-opt-merge-5.1-opt/RESYNC

--- 1.314/sql/item_strfunc.cc	2007-03-09 16:34:21 +02:00
+++ 1.315/sql/item_strfunc.cc	2007-03-11 10:11:06 +02:00
@@ -1181,11 +1181,10 @@ void Item_func_substr::fix_length_and_de
   if (args[1]->const_item())
   {
     int32 start= (int32) args[1]->val_int();
-    start= (int32)((start < 0) ? max_length + start : start - 1);
-    if (start < 0 || start >= (int32) max_length)
-      max_length=0; /* purecov: inspected */
+    if (start < 0)
+      max_length= ((uint)(-start) > max_length) ? 0 : (uint)(-start);
     else
-      max_length-= (uint) start;
+      max_length-= min((uint)(start - 1), max_length);
   }
   if (arg_count == 3 && args[2]->const_item())
   {

--- 1.140/mysql-test/r/func_str.result	2007-03-09 16:34:21 +02:00
+++ 1.141/mysql-test/r/func_str.result	2007-03-11 10:11:06 +02:00
@@ -1309,12 +1309,12 @@ explain extended select encode(f1,'zxcv'
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
 1	SIMPLE	t1	system	NULL	NULL	NULL	NULL	0	0.00	const row not found
 Warnings:
-Note	1003	select encode(`test`.`t1`.`f1`,_latin1'zxcv') AS `enc` from `test`.`t1`
+Note	1003	select encode('',_latin1'zxcv') AS `enc` from `test`.`t1`
 explain extended select decode(f1,'zxcv') as 'enc' from t1;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
 1	SIMPLE	t1	system	NULL	NULL	NULL	NULL	0	0.00	const row not found
 Warnings:
-Note	1003	select decode(`test`.`t1`.`f1`,_latin1'zxcv') AS `enc` from `test`.`t1`
+Note	1003	select decode('',_latin1'zxcv') AS `enc` from `test`.`t1`
 drop table t1;
 End of 4.1 tests
 create table t1 (d decimal default null);
@@ -1378,7 +1378,7 @@ id	select_type	table	type	possible_keys	
 1	SIMPLE	t2	const	PRIMARY	PRIMARY	12	const	1	100.00	Using index
 1	SIMPLE	t1	ref	code	code	13	const	3	100.00	Using where; Using index
 Warnings:
-Note	1003	select `test`.`t1`.`code` AS `code`,`test`.`t2`.`id` AS `id` from `test`.`t1` join `test`.`t2` where ((`test`.`t1`.`code` = _latin1'a12') and (length(`test`.`t1`.`code`) = 5))
+Note	1003	select `test`.`t1`.`code` AS `code`,'a12' AS `id` from `test`.`t1` join `test`.`t2` where ((`test`.`t1`.`code` = _latin1'a12') and (length(`test`.`t1`.`code`) = 5))
 DROP TABLE t1,t2;
 select encode(NULL, NULL);
 encode(NULL, NULL)
@@ -2273,6 +2273,17 @@ abcxx
 select lpad('abc', cast(5 as unsigned integer), 'x');
 lpad('abc', cast(5 as unsigned integer), 'x')
 xxabc
+create table t1(f1 longtext);
+insert into t1 values ("123"),("456");
+select substring(f1,1,1) from t1 group by 1;
+substring(f1,1,1)
+1
+4
+create table t2(f1 varchar(3));
+insert into t1 values ("123"),("456");
+select substring(f1,4,1), substring(f1,-4,1) from t2;
+substring(f1,4,1)	substring(f1,-4,1)
+drop table t1,t2;
 DROP TABLE IF EXISTS t1;
 CREATE TABLE `t1` (
 `id` varchar(20) NOT NULL,

--- 1.106/mysql-test/t/func_str.test	2007-03-09 16:34:21 +02:00
+++ 1.107/mysql-test/t/func_str.test	2007-03-11 10:12:27 +02:00
@@ -1116,6 +1116,17 @@ select rpad('abc', cast(5 as unsigned in
 select lpad('abc', cast(5 as unsigned integer), 'x');
 
 #
+# Bug#15757: Wrong SUBSTRING() result when a tmp table was employed.
+#
+create table t1(f1 longtext);
+insert into t1 values ("123"),("456");
+select substring(f1,1,1) from t1 group by 1;
+create table t2(f1 varchar(3));
+insert into t1 values ("123"),("456");
+select substring(f1,4,1), substring(f1,-4,1) from t2;
+drop table t1,t2;
+
+#
 # Bug #25197 :repeat function returns null when using table field directly as count
 #
 
Thread
bk commit into 5.1 tree (gkodinov:1.2478)kgeorge11 Mar