diff options
| author | Sergei Petrunia <psergey@askmonty.org> | 2021-05-16 12:30:40 +0300 |
|---|---|---|
| committer | Sergei Petrunia <psergey@askmonty.org> | 2021-05-16 12:30:40 +0300 |
| commit | 9317dc96f03f558dc20d41f7dcf003e6ebf6a2b4 (patch) | |
| tree | 6b6ef8af628555b830157e2962f11c6662a404c1 /sql/item_sum.h | |
| parent | bee1bb056dd5350c967dda65efb75e3a171e649a (diff) | |
| download | mariadb-git-bb-10.6-mdev25631.tar.gz | |
MDEV-25631: Crash in st_select_lex::mark_as_dependent with VIEW, aggregate and subquerybb-10.6-mdev25631
Name resolution code has checks like this one:
if (thd->lex->in_sum_func &&
thd->lex->in_sum_func->nest_level >= select->nest_level)
...
This fails to take into account the fact SELECT_LEX::nest_level is local
to each VIEW.
Adjust the check so that it only succeeds when the select and the aggregate
function being considered are from the same VIEW (or both from the top-level
query): add this:
+ thd->lex->in_sum_func->nest_level_base == select->nest_level_base &&
Note: this patch only modifies one such check. There are many, should they all
be adjusted in the same way?
Diffstat (limited to 'sql/item_sum.h')
| -rw-r--r-- | sql/item_sum.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/sql/item_sum.h b/sql/item_sum.h index 118f78ec5c1..10aa658c5e2 100644 --- a/sql/item_sum.h +++ b/sql/item_sum.h @@ -364,6 +364,7 @@ public: Item_sum *in_sum_func; /* embedding set function if any */ st_select_lex * aggr_sel; /* select where the function is aggregated */ int8 nest_level; /* number of the nesting level of the set function */ + st_select_lex_unit *nest_level_base; int8 aggr_level; /* nesting level of the aggregating subquery */ int8 max_arg_level; /* max level of unbound column references */ int8 max_sum_func_level;/* max level of aggregation for embedded functions */ |
