diff options
author | unknown <igor@olga.mysql.com> | 2006-07-06 11:11:49 -0700 |
---|---|---|
committer | unknown <igor@olga.mysql.com> | 2006-07-06 11:11:49 -0700 |
commit | cf7627bce09928d66129280b7903f6ab42fe2983 (patch) | |
tree | 5577fc29c2080a5650acd6e76b3af7d33d569576 /mysql-test/t/func_str.test | |
parent | 52a1639b0eb669363cfa311b5ce24aa83076a426 (diff) | |
download | mariadb-git-cf7627bce09928d66129280b7903f6ab42fe2983.tar.gz |
Fixed bug #18243.
The implementation of the method Item_func_reverse::val_str
for the REVERSE function modified the argument of the function.
This led to wrong results for expressions that contained
REVERSE(ref) if ref occurred somewhere else in the expressions.
mysql-test/r/func_str.result:
Added a test case for bug #18243.
mysql-test/t/func_str.test:
Added a test case for bug #18243.
sql/item_strfunc.cc:
Fixed bug #18243.
The implementation of the method Item_func_reverse::val_str
for the REVERSE function modified the argument of the function.
This led to wrong results for expressions that contained
REVERSE(ref) if ref occurred somewhere else in the expressions.
The implementation of Item_func_reverse::val_str has been changed
to make the argument intact.
sql/item_strfunc.h:
Fixed bug #18243.
Added tmp_value to the Item_func_reverse class to store
the result of the function. It erroneously replaced the
argument before this fix.
Diffstat (limited to 'mysql-test/t/func_str.test')
-rw-r--r-- | mysql-test/t/func_str.test | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test index c36e15a08b9..9a1c75a8dc0 100644 --- a/mysql-test/t/func_str.test +++ b/mysql-test/t/func_str.test @@ -681,4 +681,21 @@ select * from t1 where f1='test' and (f2= sha("test") or f2= sha("TEST")); select * from t1 where f1='test' and (f2= sha("TEST") or f2= sha("test")); drop table t1; +# +# Bug#18243: REVERSE changes its argument +# + +CREATE TABLE t1 (a varchar(10)); +INSERT INTO t1 VALUES ('abc'), ('xyz'); + +SELECT a, CONCAT(a,' ',a) AS c FROM t1 + HAVING LEFT(c,LENGTH(c)-INSTR(REVERSE(c)," ")) = a; + +SELECT a, CONCAT(a,' ',a) AS c FROM t1 + HAVING LEFT(CONCAT(a,' ',a), + LENGTH(CONCAT(a,' ',a))- + INSTR(REVERSE(CONCAT(a,' ',a))," ")) = a; + +DROP TABLE t1; + --echo End of 4.1 tests |