diff options
author | Ramil Kalimullin <ramil@mysql.com> | 2008-08-15 10:53:25 +0500 |
---|---|---|
committer | Ramil Kalimullin <ramil@mysql.com> | 2008-08-15 10:53:25 +0500 |
commit | 67a3d9e4d0356665728298097578931c7c5bae1f (patch) | |
tree | a08c236e1dd1f862929a2cacef67cf7afea5827d /mysql-test | |
parent | 03818bff5a59b588f14e8f1c6d47b913f01f0888 (diff) | |
download | mariadb-git-67a3d9e4d0356665728298097578931c7c5bae1f.tar.gz |
Fix for bug#37337: Function returns different results
Problem: REGEXP in functions/PSs may return wrong results
due to improper initialization.
Fix: initialize required REGEXP params.
sql/item_cmpfunc.cc:
Fix for bug#37337: Function returns different results
prev_regexp is used in the Item_func_regex::regcomp()
to store previous regex and to avoid re-initialization
if given the same pattern.
Shoud be deleted in the Item_func_regex::cleanup() where we
clean up the regexp structure.
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/func_regexp.result | 18 | ||||
-rw-r--r-- | mysql-test/t/func_regexp.test | 17 |
2 files changed, 35 insertions, 0 deletions
diff --git a/mysql-test/r/func_regexp.result b/mysql-test/r/func_regexp.result index 794ae79973a..b64f0b7f1c1 100644 --- a/mysql-test/r/func_regexp.result +++ b/mysql-test/r/func_regexp.result @@ -115,3 +115,21 @@ SELECT 1 REGEXP NULL; 1 REGEXP NULL NULL End of 5.0 tests +CREATE TABLE t1(a INT, b CHAR(4)); +INSERT INTO t1 VALUES (1, '6.1'), (1, '7.0'), (1, '8.0'); +PREPARE stmt1 FROM "SELECT a FROM t1 WHERE a=1 AND '7.0' REGEXP b LIMIT 1"; +EXECUTE stmt1; +a +1 +EXECUTE stmt1; +a +1 +EXECUTE stmt1; +a +1 +EXECUTE stmt1; +a +1 +DEALLOCATE PREPARE stmt1; +DROP TABLE t1; +End of 5.1 tests diff --git a/mysql-test/t/func_regexp.test b/mysql-test/t/func_regexp.test index 1b35fab9d54..f3677b8f5b0 100644 --- a/mysql-test/t/func_regexp.test +++ b/mysql-test/t/func_regexp.test @@ -65,3 +65,20 @@ drop table t1; SELECT 1 REGEXP NULL; --echo End of 5.0 tests + + +# +# Bug #37337: Function returns different results +# +CREATE TABLE t1(a INT, b CHAR(4)); +INSERT INTO t1 VALUES (1, '6.1'), (1, '7.0'), (1, '8.0'); +PREPARE stmt1 FROM "SELECT a FROM t1 WHERE a=1 AND '7.0' REGEXP b LIMIT 1"; +EXECUTE stmt1; +EXECUTE stmt1; +EXECUTE stmt1; +EXECUTE stmt1; +DEALLOCATE PREPARE stmt1; +DROP TABLE t1; + + +--echo End of 5.1 tests |