summaryrefslogtreecommitdiff
path: root/mysql-test/t/subselect_sj2.test
diff options
context:
space:
mode:
authorSergey Petrunya <psergey@askmonty.org>2011-09-20 20:40:07 +0400
committerSergey Petrunya <psergey@askmonty.org>2011-09-20 20:40:07 +0400
commitf0323a40d8cbc5228015c1565a4800fd05fd61a8 (patch)
treecefb6b9ba9567df1f2b6a56dd9a26206469d887f /mysql-test/t/subselect_sj2.test
parent27cd8d7b70cc22693b9dab35ac2d1e720b8fc7a7 (diff)
downloadmariadb-git-f0323a40d8cbc5228015c1565a4800fd05fd61a8.tar.gz
BUG#849763: Wrong result with second execution of prepared statement with semijoin + view
- The problem was that Item_direct_view_ref and its embedded Item_field were getting incorrect value of item->used_tables() after fix_fields() in the second and subsequent EXECUTE. - Made relevant fixes in Item_field::fix_fields() and find_field_in_tables(), so that the Item_field gets the correct attributes.
Diffstat (limited to 'mysql-test/t/subselect_sj2.test')
-rw-r--r--mysql-test/t/subselect_sj2.test18
1 files changed, 18 insertions, 0 deletions
diff --git a/mysql-test/t/subselect_sj2.test b/mysql-test/t/subselect_sj2.test
index 285146481f4..ed96168a6c8 100644
--- a/mysql-test/t/subselect_sj2.test
+++ b/mysql-test/t/subselect_sj2.test
@@ -944,4 +944,22 @@ WHERE alias2.f11 IN (
GROUP BY field2;
drop table t1, t2, t3;
+--echo #
+--echo # BUG#849763: Wrong result with second execution of prepared statement with semijoin + view
+--echo #
+CREATE TABLE t1 ( c varchar(1)) engine=innodb;
+INSERT INTO t1 VALUES ('r');
+
+CREATE TABLE t2 ( a integer, b varchar(1), c varchar(1)) engine=innodb;
+INSERT INTO t2 VALUES (1,'r','r');
+
+CREATE OR REPLACE VIEW v1 AS SELECT * FROM t1;
+
+PREPARE st1 FROM 'SELECT * FROM t2 WHERE a = SOME (SELECT a FROM v1 WHERE v1.c = t2.c)';
+EXECUTE st1;
+EXECUTE st1;
+
+DROP VIEW v1;
+DROP TABLE t1, t2;
+
set optimizer_switch=@subselect_sj2_tmp;