mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
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.
This commit is contained in:
@@ -1021,4 +1021,19 @@ select * from t1 where f1='test' and (f2= sha("TEST") or f2= sha("test"));
|
||||
f1 f2
|
||||
test a94a8fe5ccb19ba61c4c0873d391e987982fbbd3
|
||||
drop table t1;
|
||||
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;
|
||||
a c
|
||||
abc abc abc
|
||||
xyz xyz xyz
|
||||
SELECT a, CONCAT(a,' ',a) AS c FROM t1
|
||||
HAVING LEFT(CONCAT(a,' ',a),
|
||||
LENGTH(CONCAT(a,' ',a))-
|
||||
INSTR(REVERSE(CONCAT(a,' ',a))," ")) = a;
|
||||
a c
|
||||
abc abc abc
|
||||
xyz xyz xyz
|
||||
DROP TABLE t1;
|
||||
End of 4.1 tests
|
||||
|
||||
Reference in New Issue
Block a user