List:Commits« Previous MessageNext Message »
From:eugene Date:January 11 2006 8:16pm
Subject:bk commit into 5.0 tree (evgen:1.1994) BUG#15347
View as plain text  
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 06/01/11 23:16:21 evgen@stripped +3 -0
  Fixed bug #15347: Wrong result of subselect when records cache and set
  functions are involved.
  
  When subselect is a join with set functions and no record have been found in
  it, end_send_group() sets null_row for all tables in order aggregate functions 
  to calculate their values correctly. Normally this null_row flag is cleared for 
  each table in sub_select(), but flush_cached_records() doesn't do so.
  Due to this all fields from the table processed by flush_cached_records() are 
  always evaluated as nulls and whole select produces wrong result.
  
  flush_cached_records() now clears null_row flag at the very beginning.

  sql/sql_select.cc
    1.381 06/01/11 23:13:38 evgen@stripped +1 -0
    Fixed bug #15347: Wrong result of subselect when records cache and set functions are involved
    flush_cached_records() now clears null_row flag at the very beginning.

  mysql-test/r/select.result
    1.115 06/01/11 23:10:50 evgen@stripped +11 -0
    Added test case for bug #15347: Wrong result of subselect when records cache
    and set functions are involved

  mysql-test/t/select.test
    1.94 06/01/11 23:08:59 evgen@stripped +13 -0
    Added test case for bug #15347: Wrong result of subselect when records cache
    and set functions are involved

# 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	2006-01-11 23:13:38 +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	2006-01-11 23:10:50 +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	2006-01-11 23:08:59 +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 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;
Thread
bk commit into 5.0 tree (evgen:1.1994) BUG#15347eugene11 Jan