summaryrefslogtreecommitdiff
path: root/plugin/feedback/feedback.cc
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2021-07-23 11:14:13 +0200
committerOleksandr Byelkin <sanja@mariadb.com>2021-09-27 11:00:51 +0200
commit3690c549c6e72646ba74f6b4c83813ee4ac3aea4 (patch)
treee619941de38c42f99b6377e8af00a78700bcfbb1 /plugin/feedback/feedback.cc
parent1a62c878970fea6d2013c432bbd5aae30dbaca89 (diff)
downloadmariadb-git-3690c549c6e72646ba74f6b4c83813ee4ac3aea4.tar.gz
MDEV-24454 Crash at change_item_treebb-10.2-MDEV-24454
Use in_sum_func (and so nest_level) only in LEX to which SELECT lex belong to Reduce usage of current_select (because it does not always point on the correct SELECT_LEX, for example with prepare. Change context for all classes inherited from Item_ident (was only for Item_field) in case of pushing down it to HAVING. Now name resolution context have to have SELECT_LEX reference if the context is present. Fixed feedback plugin stack usage.
Diffstat (limited to 'plugin/feedback/feedback.cc')
-rw-r--r--plugin/feedback/feedback.cc12
1 files changed, 7 insertions, 5 deletions
diff --git a/plugin/feedback/feedback.cc b/plugin/feedback/feedback.cc
index c76828efa2b..3f6cc9dddbc 100644
--- a/plugin/feedback/feedback.cc
+++ b/plugin/feedback/feedback.cc
@@ -92,16 +92,18 @@ static COND * const OOM= (COND*)1;
static COND* make_cond(THD *thd, TABLE_LIST *tables, LEX_STRING *filter)
{
Item_cond_or *res= NULL;
- Name_resolution_context nrc;
+ /* A reference to this context will be stored in Item_field */
+ Name_resolution_context *nrc= new (thd->mem_root) Name_resolution_context;
const char *db= tables->db, *table= tables->alias,
*field= tables->table->field[0]->field_name;
CHARSET_INFO *cs= &my_charset_latin1;
- if (!filter->str)
+ if (!filter->str || !nrc)
return 0;
- nrc.init();
- nrc.resolve_in_table_list_only(tables);
+ nrc->init();
+ nrc->resolve_in_table_list_only(tables);
+ nrc->select_lex= tables->select_lex;
res= new (thd->mem_root) Item_cond_or(thd);
if (!res)
@@ -109,7 +111,7 @@ static COND* make_cond(THD *thd, TABLE_LIST *tables, LEX_STRING *filter)
for (; filter->str; filter++)
{
- Item_field *fld= new (thd->mem_root) Item_field(thd, &nrc, db, table,
+ Item_field *fld= new (thd->mem_root) Item_field(thd, nrc, db, table,
field);
Item_string *pattern= new (thd->mem_root) Item_string(thd, filter->str,
(uint) filter->length, cs);