summaryrefslogtreecommitdiff
path: root/mysql-test/r/subselect_sj.result
diff options
context:
space:
mode:
authorSergey Petrunya <psergey@askmonty.org>2010-03-14 20:54:12 +0300
committerSergey Petrunya <psergey@askmonty.org>2010-03-14 20:54:12 +0300
commit77e66c69851c6b328053a5e522bf6daba24828b2 (patch)
tree868f3c053ebe0c1ef75dd7cd836678ec01982537 /mysql-test/r/subselect_sj.result
parentc2924e155e2b8edaec11cc08f37fd0201e5a23d8 (diff)
downloadmariadb-git-77e66c69851c6b328053a5e522bf6daba24828b2.tar.gz
BUG#43768: Prepared query with nested subqueries core dumps on second execution
Fix two problems: 1. Let optimize_semijoin_nests() reset sj_nest->sjmat_info irrespectively of value of optimizer_flag. We need this in case somebody has turned optimization off between reexecutions of the same statement. 2. Do not pull out constant tables out of semi-join nests. The problem is that pullout operation is not undoable, and if a table is constant because it is 1/0-row table it may cease to be constant on the next execution. Note that tables that are constant because of possible eq_ref(const) access will still be pulled out as they are considered functionally-dependent.
Diffstat (limited to 'mysql-test/r/subselect_sj.result')
-rw-r--r--mysql-test/r/subselect_sj.result53
1 files changed, 52 insertions, 1 deletions
diff --git a/mysql-test/r/subselect_sj.result b/mysql-test/r/subselect_sj.result
index d2308f9069c..00798a6b256 100644
--- a/mysql-test/r/subselect_sj.result
+++ b/mysql-test/r/subselect_sj.result
@@ -1,4 +1,4 @@
-drop table if exists t0, t1, t2, t10, t11, t12;
+drop table if exists t0, t1, t2, t3, t4, t10, t11, t12;
create table t0 (a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1(a int, b int);
@@ -871,3 +871,54 @@ id select_type table type possible_keys key key_len ref rows Extra
DROP TABLE t1, t2, t3;
DROP VIEW v2, v3;
# End of Bug#49198
+#
+# BUG#43768: Prepared query with nested subqueries core dumps on second execution
+#
+create table t1 (
+id int(11) unsigned not null primary key auto_increment,
+partner_id varchar(35) not null,
+t1_status_id int(10) unsigned
+);
+insert into t1 values ("1", "partner1", "10"), ("2", "partner2", "10"),
+("3", "partner3", "10"), ("4", "partner4", "10");
+create table t2 (
+id int(11) unsigned not null default '0',
+t1_line_id int(11) unsigned not null default '0',
+article_id varchar(20),
+sequence int(11) not null default '0',
+primary key (id,t1_line_id)
+);
+insert into t2 values ("1", "1", "sup", "0"), ("2", "1", "sup", "1"),
+("2", "2", "sup", "2"), ("2", "3", "sup", "3"),
+("2", "4", "imp", "4"), ("3", "1", "sup", "0"),
+("4", "1", "sup", "0");
+create table t3 (
+id int(11) not null default '0',
+preceeding_id int(11) not null default '0',
+primary key (id,preceeding_id)
+);
+create table t4 (
+user_id varchar(50) not null,
+article_id varchar(20) not null,
+primary key (user_id,article_id)
+);
+insert into t4 values("nicke", "imp");
+prepare stmt from
+'select t1.partner_id
+from t1
+where
+ t1.id in (
+ select pl_inner.id
+ from t2 as pl_inner
+ where pl_inner.article_id in (
+ select t4.article_id from t4
+ where t4.user_id = \'nicke\'
+ )
+ )';
+execute stmt;
+partner_id
+partner2
+execute stmt;
+partner_id
+partner2
+drop table t1,t2,t3,t4;