summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorVarun Gupta <varun.gupta@mariadb.com>2020-03-30 08:03:54 +0530
committerVarun Gupta <varun.gupta@mariadb.com>2020-03-30 08:03:54 +0530
commitb11ff3d49581d9e7b6f8b990f08e85e4d6384418 (patch)
tree8739837e35fd08595263a46817430a84810ff3c8 /sql
parent0b00c1a22f7861e6a5be5041a915ccafceb0669c (diff)
downloadmariadb-git-b11ff3d49581d9e7b6f8b990f08e85e4d6384418.tar.gz
MDEV-22019: Sig 11 in next_breadth_first_tab | max_sort_length setting + double GROUP BY leads to crash
No need to create a temp table for aggregation if we have encountered some error.
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_select.cc8
-rw-r--r--sql/sql_show.cc7
2 files changed, 9 insertions, 6 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 97002ef071f..c601946cfa0 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -2210,8 +2210,12 @@ JOIN::optimize_inner()
having_is_correlated= MY_TEST(having->used_tables() & OUTER_REF_TABLE_BIT);
tmp_having= having;
- if ((select_lex->options & OPTION_SCHEMA_TABLE))
- optimize_schema_tables_reads(this);
+ if ((select_lex->options & OPTION_SCHEMA_TABLE) &&
+ optimize_schema_tables_reads(this))
+ DBUG_RETURN(TRUE);
+
+ if (unlikely(thd->is_error()))
+ DBUG_RETURN(TRUE);
/*
The loose index scan access method guarantees that all grouping or
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 78ca1d09e7a..4e37b53b87e 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -8299,7 +8299,6 @@ end:
bool optimize_schema_tables_reads(JOIN *join)
{
THD *thd= join->thd;
- bool result= 0;
DBUG_ENTER("optimize_schema_tables_reads");
JOIN_TAB *tab;
@@ -8334,11 +8333,11 @@ bool optimize_schema_tables_reads(JOIN *join)
*/
cond= tab->cache_select->cond;
}
-
- optimize_for_get_all_tables(thd, table_list, cond);
+ if (optimize_for_get_all_tables(thd, table_list, cond))
+ DBUG_RETURN(TRUE); // Handle OOM
}
}
- DBUG_RETURN(result);
+ DBUG_RETURN(FALSE);
}