diff options
author | Mithun C Y <mithun.c.y@oracle.com> | 2015-01-30 16:36:23 +0530 |
---|---|---|
committer | Mithun C Y <mithun.c.y@oracle.com> | 2015-01-30 16:36:23 +0530 |
commit | c9f7948bc47edc7ddc3b3693b9a3e4b623a97ca6 (patch) | |
tree | dc95b60306b700e4277da69f732b4b718ddda08b /sql/sql_yacc.yy | |
parent | 08526dfb0109a5809101ec7818a9514b2f5ea606 (diff) | |
download | mariadb-git-c9f7948bc47edc7ddc3b3693b9a3e4b623a97ca6.tar.gz |
Bug #19892803: ASSERTION FAILED: N < M_SIZE WITH DISTINCT TIME
ISSUE:
------
We pre-allocate the ref_pointer_array before we resolve outer
references. This means that in some cases the
ref_pointer_array may not be large enough to hold all
references created. One such case is aggregate functions in
having clause of a subquery which may add items to select list
of outer query. So it is necessary to consider
select_n_having_items for subqueries while allocating
ref_pointer_array else we will get buffer overflow.
SOLUTION:
---------
Allocate a larger ref_pointer_array by aggregating
select_n_having_items for subqueries.
The fix in sql_yacc.yy is a backport from bug fix 18782905.
Diffstat (limited to 'sql/sql_yacc.yy')
-rw-r--r-- | sql/sql_yacc.yy | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 74a21c9f6b6..b32f7d26cf3 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -14128,6 +14128,13 @@ subselect_end: */ lex->current_select->select_n_where_fields+= child->select_n_where_fields; + + /* + Aggregate functions in having clause may add fields to an outer + select. Count them also. + */ + lex->current_select->select_n_having_items+= + child->select_n_having_items; } ; |