diff options
author | Sergey Petrunya <psergey@askmonty.org> | 2010-02-24 12:33:42 +0100 |
---|---|---|
committer | Sergey Petrunya <psergey@askmonty.org> | 2010-02-24 12:33:42 +0100 |
commit | 0e7c84153d4fdf03d626ad59215912f2bf8ac030 (patch) | |
tree | f162ef93d52ef33255ef72e831311585a54e8b00 /mysql-test/t/subselect_sj.test | |
parent | 279b8efd096d092945952c459957311919a86a11 (diff) | |
download | mariadb-git-0e7c84153d4fdf03d626ad59215912f2bf8ac030.tar.gz |
Bug#49198 Wrong result for second call of of procedure with view in subselect.
Re-worked fix of Tor Didriksen:
The problem was that fix_after_pullout() after semijoin conversion
wasn't propagated from the view to the underlying table.
On subesequent executions of the prepared statement,
we would mark the underlying table as 'dependent' and the predicate
anlysis would lead to a different (and illegal) execution plan.
Diffstat (limited to 'mysql-test/t/subselect_sj.test')
-rw-r--r-- | mysql-test/t/subselect_sj.test | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/mysql-test/t/subselect_sj.test b/mysql-test/t/subselect_sj.test index f2f8d5caafa..a082772aee1 100644 --- a/mysql-test/t/subselect_sj.test +++ b/mysql-test/t/subselect_sj.test @@ -728,3 +728,45 @@ where a in (select c from t2 where d >= some(select e from t3 where b=e)); drop table t1, t2, t3; +--echo # +--echo # Bug#49198 Wrong result for second call of procedure +--echo # with view in subselect. +--echo # + +CREATE TABLE t1 (t1field integer, primary key (t1field)); +CREATE TABLE t2 (t2field integer, primary key (t2field)); +CREATE TABLE t3 (t3field integer, primary key (t3field)); + +CREATE VIEW v2 AS SELECT * FROM t2; +CREATE VIEW v3 AS SELECT * FROM t3; + +INSERT INTO t1 VALUES(1),(2); +INSERT INTO t2 VALUES(1),(2); +INSERT INTO t3 VALUES(1),(2); + +PREPARE stmt FROM +" +SELECT t1field +FROM t1 +WHERE t1field IN (SELECT * FROM v2); +"; + +EXECUTE stmt; +EXECUTE stmt; + +PREPARE stmt FROM +" +EXPLAIN +SELECT t1field +FROM t1 +WHERE t1field IN (SELECT * FROM v2) + AND t1field IN (SELECT * FROM v3) +"; + +EXECUTE stmt; +EXECUTE stmt; + +DROP TABLE t1, t2, t3; +DROP VIEW v2, v3; + +--echo # End of Bug#49198 |