From 511078bf2e58fc9e3f4ebde706bac7f6d6e46a40 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 11 Jan 2006 23:16:21 +0300 Subject: 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. mysql-test/t/select.test: Added test case for bug #15347: Wrong result of subselect when records cache and set functions are involved mysql-test/r/select.result: Added test case for bug #15347: Wrong result of subselect when records cache and set functions are involved sql/sql_select.cc: 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. --- sql/sql_select.cc | 1 + 1 file changed, 1 insertion(+) (limited to 'sql/sql_select.cc') diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 8538372d607..4573598cd29 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -9853,6 +9853,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) -- cgit v1.2.1