summaryrefslogtreecommitdiff
path: root/mysql-test/r/func_str.result
diff options
context:
space:
mode:
authorunknown <igor@olga.mysql.com>2007-06-17 11:23:19 -0700
committerunknown <igor@olga.mysql.com>2007-06-17 11:23:19 -0700
commita07b055b9ab75b54e9df33bb7634bde22543e8f1 (patch)
treea2fb6dabdae243780ae0d3845d1c3d2f008d8826 /mysql-test/r/func_str.result
parentbcd6183fe7f242648ce6e04c8224c98531f1cbff (diff)
downloadmariadb-git-a07b055b9ab75b54e9df33bb7634bde22543e8f1.tar.gz
Fixed bug #27130. If the third argument of the function SUBSTR was
represented by an expression of the type UNSIGNED INT and this expression was evaluated to 0 then the function erroneously returned the value of the first argument instead of an empty string. This problem was introduced by the patch for bug 10963. The problem has been resolved by a proper modification of the code of Item_func_substr::val_str. mysql-test/r/func_str.result: Added a test case for bug #27130. mysql-test/t/func_str.test: Added a test case for bug #27130.
Diffstat (limited to 'mysql-test/r/func_str.result')
-rw-r--r--mysql-test/r/func_str.result16
1 files changed, 16 insertions, 0 deletions
diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result
index d8afbe13c76..0dd7bd8f309 100644
--- a/mysql-test/r/func_str.result
+++ b/mysql-test/r/func_str.result
@@ -2061,4 +2061,20 @@ C
2707236321
DROP TABLE t1, t2;
DROP VIEW v1;
+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