summaryrefslogtreecommitdiff
path: root/sql/sql_join_cache.cc
diff options
context:
space:
mode:
authorSergey Petrunya <psergey@askmonty.org>2011-03-01 12:01:10 +0300
committerSergey Petrunya <psergey@askmonty.org>2011-03-01 12:01:10 +0300
commitb8f00542e2ed66803d747cc5151279b9edf1392a (patch)
treee19317275e2ff2c17f13179b21577da09a0c3b1d /sql/sql_join_cache.cc
parent862135a18a626648c66b4f4c450d819d4f382818 (diff)
downloadmariadb-git-b8f00542e2ed66803d747cc5151279b9edf1392a.tar.gz
BUG#724228: Wrong result with materialization=on and three aggregates in maria-5.3-mwl90
- In join buffering code, call join_tab_execution_startup() (#1) before we call join_tab_scan->open() (#2). This is important with SJ-Materialization because #1 fills the materialized table, while #2 will actually try to read the first row. Attempt to read the first row before we have populated the materialized table would cause zero rows to be returned when actually there were matches.
Diffstat (limited to 'sql/sql_join_cache.cc')
-rw-r--r--sql/sql_join_cache.cc7
1 files changed, 3 insertions, 4 deletions
diff --git a/sql/sql_join_cache.cc b/sql/sql_join_cache.cc
index 921144d9ec1..ec8fd9997f6 100644
--- a/sql/sql_join_cache.cc
+++ b/sql/sql_join_cache.cc
@@ -2139,14 +2139,13 @@ enum_nested_loop_state JOIN_CACHE::join_matching_records(bool skip_last)
join_tab->select->quick= 0;
}
+ if ((rc= join_tab_execution_startup(join_tab)) < 0)
+ goto finish;
+
/* Prepare to retrieve all records of the joined table */
if ((error= join_tab_scan->open()))
goto finish; /* psergey-note: if this returns error, we will assert in net_send_statement() */
- if ((rc= join_tab_execution_startup(join_tab)) < 0)
- goto finish;
-
-
while (!(error= join_tab_scan->next()))
{
if (join->thd->killed)