summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorevgen@moonbone.local <>2006-01-13 16:27:38 +0300
committerevgen@moonbone.local <>2006-01-13 16:27:38 +0300
commitcea01c738703b8e318edf8be0127415108f792f4 (patch)
tree3062fb6d2e69a8d993d959081f04a1a1209e6abe
parent02570c20bf200e0c7e3198fa29e9b91bea8bd688 (diff)
parent3e23d458f931362a4d787fa8086dff38073870a8 (diff)
downloadmariadb-git-cea01c738703b8e318edf8be0127415108f792f4.tar.gz
Merge
-rw-r--r--mysql-test/r/select.result11
-rw-r--r--mysql-test/t/select.test13
-rw-r--r--sql/sql_select.cc1
3 files changed, 25 insertions, 0 deletions
diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result
index 6201667312f..df68cdfff53 100644
--- a/mysql-test/r/select.result
+++ b/mysql-test/r/select.result
@@ -3337,6 +3337,17 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 Using index
1 SIMPLE t3 const PRIMARY PRIMARY 8 const,const 1
DROP TABLE t1,t2,t3;
+create table t1 (f1 int);
+insert into t1 values(1),(2);
+create table t2 (f2 int, f3 int, key(f2));
+insert into t2 values(1,1),(2,2);
+create table t3 (f4 int not null);
+insert into t3 values (2),(2),(2);
+select f1,(select count(*) from t2,t3 where f2=f1 and f3=f4) as count from t1;
+f1 count
+1 0
+2 3
+drop table t1,t2,t3;
create table t1 (f1 int unique);
create table t2 (f2 int unique);
create table t3 (f3 int unique);
diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test
index 826f1c205c1..01d5f2eb4d1 100644
--- a/mysql-test/t/select.test
+++ b/mysql-test/t/select.test
@@ -2807,6 +2807,19 @@ EXPLAIN SELECT t2.key_a,foo
DROP TABLE t1,t2,t3;
#
+# Bug#15347 Wrong result of subselect when records cache and set functions
+# are involved
+#
+create table t1 (f1 int);
+insert into t1 values(1),(2);
+create table t2 (f2 int, f3 int, key(f2));
+insert into t2 values(1,1),(2,2);
+create table t3 (f4 int not null);
+insert into t3 values (2),(2),(2);
+select f1,(select count(*) from t2,t3 where f2=f1 and f3=f4) as count from t1;
+drop table t1,t2,t3;
+
+#
# Bug #15633 Evaluation of Item_equal for non-const table caused wrong
# select result
#
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 8be8dd3e599..ab58fda8dea 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -9896,6 +9896,7 @@ flush_cached_records(JOIN *join,JOIN_TAB *join_tab,bool skip_last)
int error;
READ_RECORD *info;
+ join_tab->table->null_row= 0;
if (!join_tab->cache.records)
return NESTED_LOOP_OK; /* Nothing to do */
if (skip_last)