summaryrefslogtreecommitdiff
path: root/mysql-test/r/subselect2.result
diff options
context:
space:
mode:
authorunknown <gkodinov/kgeorge@macbook.gmz>2006-07-26 19:19:30 +0300
committerunknown <gkodinov/kgeorge@macbook.gmz>2006-07-26 19:19:30 +0300
commit6b75e24b73828316dd1715ab32811a614ce74314 (patch)
treeca83992c1a7ce36e317510d0914c01097a8ed11c /mysql-test/r/subselect2.result
parent5a77e566abb4c486a296c1ad762ddfe740db695e (diff)
downloadmariadb-git-6b75e24b73828316dd1715ab32811a614ce74314.tar.gz
* Bug #20792: Incorrect results from aggregate subquery
When processing aggregate functions all tables values are reset to NULLs at the end of each group. When doing that if there are no rows found for a group the const tables must not be reset as they are not recalculated by do_select()/sub_select() for each group. mysql-test/r/subselect2.result: * Bug #20792: Incorrect results from aggregate subquery - test suite for the bug. This is dependent on InnoDB despite the fact that the bug and the fix are not InnoDB specific. This is because of the table flag HA_NOT_EXACT_COUNT. When this flag is off (as in MyISAM) both t2 and t3 become of join type 'system' as they are estimated to have 1 record and and this statistics can be trusted (according to the absence of HA_NOT_EXACT_COUNT). mysql-test/t/subselect2.test: * Bug #20792: Incorrect results from aggregate subquery - test suite for the bug sql/sql_select.cc: * Bug #20792: Incorrect results from aggregate subquery - when clearing results if there are not rows found for group the const tables must not be reset as they are not recalculated for each group.
Diffstat (limited to 'mysql-test/r/subselect2.result')
-rw-r--r--mysql-test/r/subselect2.result12
1 files changed, 12 insertions, 0 deletions
diff --git a/mysql-test/r/subselect2.result b/mysql-test/r/subselect2.result
index 8fcfa06a8ae..db1848105f8 100644
--- a/mysql-test/r/subselect2.result
+++ b/mysql-test/r/subselect2.result
@@ -130,3 +130,15 @@ id select_type table type possible_keys key key_len ref rows Extra
5 DEPENDENT SUBQUERY t3 unique_subquery PRIMARY,FFOLDERID_IDX PRIMARY 32 func 1 Using index; Using where
6 DEPENDENT SUBQUERY t3 unique_subquery PRIMARY,FFOLDERID_IDX,CMFLDRPARNT_IDX PRIMARY 32 func 1 Using index; Using where
drop table t1, t2, t3, t4;
+CREATE TABLE t1 (a int(10) , PRIMARY KEY (a)) Engine=InnoDB;
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (a int(10), PRIMARY KEY (a)) Engine=InnoDB;
+INSERT INTO t2 VALUES (1);
+CREATE TABLE t3 (a int(10), b int(10), c int(10),
+PRIMARY KEY (a)) Engine=InnoDB;
+INSERT INTO t3 VALUES (1,2,1);
+SELECT t1.* FROM t1 WHERE (SELECT COUNT(*) FROM t3,t2 WHERE t3.c=t2.a
+and t2.a='1' AND t1.a=t3.b) > 0;
+a
+2
+DROP TABLE t1,t2,t3;