From dae4fb0acb373e653f826f0ec7bdaf2485ef0b93 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Tue, 30 Jan 2018 11:07:35 +0400 Subject: MDEV-15118 ExtractValue(xml,something_complex) does not work Item_xml_str_func::fix_fields() used a local "String tmp" as a buffer for args[1]->val_str(). "tmp" was freed at the end of fix_fields(), while Items created during my_xpath_parse() still pointed to its fragments. Adding a new member Item_xml_str_func::m_xpath_query and store the result of args[1]->val_str() into it. --- mysql-test/t/xml.test | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'mysql-test/t/xml.test') diff --git a/mysql-test/t/xml.test b/mysql-test/t/xml.test index 371fcb72b0d..e9e7864c418 100644 --- a/mysql-test/t/xml.test +++ b/mysql-test/t/xml.test @@ -748,6 +748,15 @@ SELECT *,IF(@i:=c1,ExtractValue('b1b2','//b[$@i]'),0) AS xp SELECT * FROM t1 WHERE c2=IF(@i:=c1,ExtractValue('b1b2','//b[$@i]'),0); DROP TABLE t1; +--echo # +--echo # MDEV-15118 ExtractValue(xml,something_complex) does not work +--echo # + +CREATE TABLE t1 (a TEXT); +INSERT INTO t1 VALUES (CONCAT('aaa')); +SELECT ExtractValue(a, '/a') AS a FROM t1; +SELECT ExtractValue(a, FROM_BASE64(TO_BASE64('/a'))) AS a FROM t1; +DROP TABLE t1; --echo # --echo # End of 10.0 tests -- cgit v1.2.1