Below is the list of changes that have just been committed into a local
5.1 repository of uchum. When uchum 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-06-18 17:08:56+05:00, gshchepa@stripped +3 -0
Merge gleb.loc:/home/uchum/work/bk/5.0-opt
into gleb.loc:/home/uchum/work/bk/5.1-opt
MERGE: 1.1810.2945.49
mysql-test/r/func_str.result@stripped, 2007-06-18 17:08:52+05:00, gshchepa@stripped +0 -0
Auto merged
MERGE: 1.110.1.26
mysql-test/t/func_str.test@stripped, 2007-06-18 17:08:52+05:00, gshchepa@stripped +0 -0
Auto merged
MERGE: 1.92.1.15
sql/item_strfunc.cc@stripped, 2007-06-18 17:08:53+05:00, gshchepa@stripped +0 -0
Auto merged
MERGE: 1.261.1.42
# 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: gshchepa
# Host: gleb.loc
# Root: /home/uchum/work/bk/5.1-opt/RESYNC
--- 1.324/sql/item_strfunc.cc 2007-06-12 18:10:59 +05:00
+++ 1.325/sql/item_strfunc.cc 2007-06-18 17:08:53 +05:00
@@ -1143,8 +1143,9 @@ String *Item_func_substr::val_str(String
(arg_count == 3 && args[2]->null_value))))
return 0; /* purecov: inspected */
- /* Negative length, will return empty string. */
- if ((arg_count == 3) && (length <= 0) && !args[2]->unsigned_flag)
+ /* Negative or zero length, will return empty string. */
+ if ((arg_count == 3) && (length <= 0) &&
+ (length == 0 || !args[2]->unsigned_flag))
return &my_empty_string;
/* Assumes that the maximum length of a String is < INT_MAX32. */
--- 1.145/mysql-test/r/func_str.result 2007-06-16 22:37:58 +05:00
+++ 1.146/mysql-test/r/func_str.result 2007-06-18 17:08:52 +05:00
@@ -2470,4 +2470,20 @@ id
3
4
DROP TABLE t1;
+SELECT SUBSTR('foo',1,0) FROM DUAL;
+SUBSTR('foo',1,0)
+
+SELECT SUBSTR('foo',1,CAST(0 AS SIGNED)) FROM DUAL;
+SUBSTR('foo',1,CAST(0 AS SIGNED))
+
+SELECT SUBSTR('foo',1,CAST(0 AS UNSIGNED)) FROM DUAL;
+SUBSTR('foo',1,CAST(0 AS UNSIGNED))
+
+CREATE TABLE t1 (a varchar(10), len int unsigned);
+INSERT INTO t1 VALUES ('bar', 2), ('foo', 0);
+SELECT SUBSTR(a,1,len) FROM t1;
+SUBSTR(a,1,len)
+ba
+
+DROP TABLE t1;
End of 5.0 tests
--- 1.111/mysql-test/t/func_str.test 2007-06-16 22:37:58 +05:00
+++ 1.112/mysql-test/t/func_str.test 2007-06-18 17:08:52 +05:00
@@ -1216,4 +1216,19 @@ SELECT id FROM t1 WHERE LOCATE(a,p) <=>
DROP TABLE t1;
+#
+# Bug #27130: SUBSTR with UNSIGNED 0 as the last argument
+#
+
+SELECT SUBSTR('foo',1,0) FROM DUAL;
+SELECT SUBSTR('foo',1,CAST(0 AS SIGNED)) FROM DUAL;
+SELECT SUBSTR('foo',1,CAST(0 AS UNSIGNED)) FROM DUAL;
+
+CREATE TABLE t1 (a varchar(10), len int unsigned);
+INSERT INTO t1 VALUES ('bar', 2), ('foo', 0);
+
+SELECT SUBSTR(a,1,len) FROM t1;
+
+DROP TABLE t1;
+
--echo End of 5.0 tests
| Thread |
|---|
| • bk commit into 5.1 tree (gshchepa:1.2554) | gshchepa | 18 Jun |