Below is the list of changes that have just been committed into a local
5.0 repository of evgen. When evgen does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.1994 05/12/10 01:13:17 evgen@stripped +3 -0
Fix bug #15347 Wrong result of subselect when records cache and grouping
was involved
When subselect is a join with grouping and no records is found, end_send_group
sets null_row for all tables so grouping functions can correctly calculate their
values. Normally this null_row cleared for each pass in sub_select(), but
when flush_cached_records doesn't clear it. This results that values from this
table always null thus producing wrong result.
flush_cached_records() now clears null_row flag at the very begining.
mysql-test/r/select.result
1.115 05/12/10 01:12:26 evgen@stripped +11 -0
Test case for bug#15347 Wrong result of subselect when records cache and grouping was
involved
mysql-test/t/select.test
1.94 05/12/10 01:12:11 evgen@stripped +13 -0
Test case for bug#15347 Wrong result of subselect when records cache and grouping was
involved
sql/sql_select.cc
1.381 05/12/10 01:11:36 evgen@stripped +1 -0
Fix bug #15347 Wrong result of subselect when records cache and grouping was involved
flush_cached_records() now clears null_row flag at the very begining.
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: evgen
# Host: moonbone.local
# Root: /work/15347-bug-5.0-mysql
--- 1.380/sql/sql_select.cc 2005-12-07 17:01:08 +03:00
+++ 1.381/sql/sql_select.cc 2005-12-10 01:11:36 +03:00
@@ -9853,6 +9853,7 @@
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)
--- 1.114/mysql-test/r/select.result 2005-11-26 05:51:39 +03:00
+++ 1.115/mysql-test/r/select.result 2005-12-10 01:12:26 +03:00
@@ -3337,3 +3337,14 @@
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;
--- 1.93/mysql-test/t/select.test 2005-11-26 05:51:39 +03:00
+++ 1.94/mysql-test/t/select.test 2005-12-10 01:12:11 +03:00
@@ -2805,3 +2805,16 @@
WHERE t2.key_a=2 and key_b=5;
DROP TABLE t1,t2,t3;
+
+#
+# Bug#15347 Wrong result of subselect when records cache and grouping
+# was 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;
| Thread |
|---|
| • bk commit into 5.0 tree (evgen:1.1994) BUG#15347 | eugene | 9 Dec |