1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-12575: Server crash in AGGR_OP::put_record or in JOIN_CACHE::free or Invalid write in JOIN::make_aggr_tables_info

During the optimize state of a query, we come know that the result set
would atmost contain one row, then for such a query we don't need
to compute GROUP BY, ORDER BY and DISTINCT.
This commit is contained in:
Varun Gupta
2018-11-09 19:53:40 +05:30
parent 5cfb043d29
commit a12b8ac8e9
7 changed files with 190 additions and 0 deletions

View File

@ -2245,6 +2245,18 @@ setup_subq_exit:
if (!tables_list || !table_count)
{
choose_tableless_subquery_plan();
/* The output has atmost one row */
if (group_list)
{
group_list= NULL;
group_optimized_away= 1;
rollup.state= ROLLUP::STATE_NONE;
}
order= NULL;
simple_order= TRUE;
select_distinct= FALSE;
if (select_lex->have_window_funcs())
{
if (!(join_tab= (JOIN_TAB*) thd->alloc(sizeof(JOIN_TAB))))