diff --git a/sql/group_by_handler.h b/sql/group_by_handler.h index 993e94819a2..b05b7fd39ae 100644 --- a/sql/group_by_handler.h +++ b/sql/group_by_handler.h @@ -74,30 +74,6 @@ public: : thd(thd_arg), ht(ht_arg), table(0) {} virtual ~group_by_handler() {} - /* - Store pointer to temporary table and objects modified to point to - the temporary table. This will happen during the optimize phase. - - We provide new 'having' and 'order_by' elements here. The differ from the - original ones in that these are modified to point to fields in the - temporary table 'table'. - - Return 1 if the storage handler cannot handle the GROUP BY after all, - in which case we have to give an error to the end user for the query. - This is becasue we can't revert back the old having and order_by elements. - */ - - virtual bool init(Item *having_arg, ORDER *order_by_arg) - { - return 0; - } - - bool ha_init(TABLE *temporary_table, Item *having_arg, ORDER *order_by_arg) - { - table= temporary_table; - return init(having_arg, order_by_arg); - } - /* Functions to scan data. All these returns 0 if ok, error code in case of error diff --git a/sql/sql_select.cc b/sql/sql_select.cc index af8571fb714..d1912ac3e46 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -1922,7 +1922,6 @@ JOIN::optimize_inner() if (gbh) { pushdown_query= new (thd->mem_root) Pushdown_query(select_lex, gbh); - int err; /* We must store rows in the tmp table if we need to do an ORDER BY @@ -1953,11 +1952,8 @@ JOIN::optimize_inner() DBUG_RETURN(1); /* Give storage engine access to temporary table */ - if ((err= gbh->ha_init(exec_tmp_table1, having, order))) - { - gbh->print_error(err, MYF(0)); - DBUG_RETURN(1); - } + gbh->table= exec_tmp_table1; + pushdown_query->store_data_in_temp_table= need_tmp; pushdown_query->having= having; /*