summaryrefslogtreecommitdiff
path: root/mysql-test/r/group_by.result
diff options
context:
space:
mode:
authorSergei Petrunia <psergey@askmonty.org>2016-02-24 17:14:38 +0300
committerSergei Petrunia <psergey@askmonty.org>2016-02-24 17:18:53 +0300
commitb05158cc10a75196b5c0bf8dad9360608a2dd5b9 (patch)
tree0d39411d70f33f1817a4cc5c88c33373659c5feb /mysql-test/r/group_by.result
parentd044507dc53731e604f3137ed7423c6b94e83aba (diff)
downloadmariadb-git-b05158cc10a75196b5c0bf8dad9360608a2dd5b9.tar.gz
MDEV-8988: Apparently valid SQL query gives wrong result (nested WHERE)mariadb-10.1.12
- "Early NULLs filtering" optimization used to "peel off" Item_ref and Item_direct_ref wrappers from an outside column reference before adding "outer_table_col IS NOT NULL" into JOIN::outer_ref_cond. - When this happened in a subquery that was evaluated in a post-GROUP-BY context, attempt to evaluate JOIN::outer_ref_cond would fetch an incorrect value of outer_table_col.
Diffstat (limited to 'mysql-test/r/group_by.result')
-rw-r--r--mysql-test/r/group_by.result38
1 files changed, 38 insertions, 0 deletions
diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result
index 7f32643b727..07773960e5a 100644
--- a/mysql-test/r/group_by.result
+++ b/mysql-test/r/group_by.result
@@ -2640,3 +2640,41 @@ field1 field2
DROP TABLE t1;
DROP TABLE where_subselect;
# End of Bug #58782
+#
+# MDEV-8988: Apparently valid SQL query gives wrong result (nested WHERE)
+#
+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, c int);
+insert into t1 select A.a + 10*B.a, A.a, A.a + 10*B.a from t0 A, t0 B;
+insert into t1 values (NULL, NULL, NULL);
+create table t2 (c int, col1 int, key(c));
+insert into t2 select t1.a, 100000 from t1;
+analyze table t2;
+Table Op Msg_type Msg_text
+test.t2 analyze status Table is already up to date
+explain
+select
+max(a)+ (select col1 from t2 where t2.c=t1.c)
+from t1
+group by t1.b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 101 Using temporary; Using filesort
+2 DEPENDENT SUBQUERY t2 ref c c 5 func 1
+select
+max(a) + (select col1 from t2 where t2.c=t1.c)
+from t1
+group by t1.b;
+max(a) + (select col1 from t2 where t2.c=t1.c)
+NULL
+100090
+100091
+100092
+100093
+100094
+100095
+100096
+100097
+100098
+100099
+drop table t0,t1,t2;