diff options
author | Sergei Golubchik <serg@mariadb.org> | 2015-07-31 10:13:01 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2015-07-31 17:17:33 +0200 |
commit | 4d5772c578bd336b1004084ad7925143137c8a4e (patch) | |
tree | c68e71423d6a4f13e1286f1b331e0897529fa3f4 /sql/item.cc | |
parent | 2721d69f792353e509056819565202483003ab3d (diff) | |
download | mariadb-git-4d5772c578bd336b1004084ad7925143137c8a4e.tar.gz |
MDEV-7810 Wrong result on execution of a query as a PS (both 1st and further executions)
Alternative fix that doesn't cause view.test crash in --ps:
Remember when Item_ref was fixed right in the constructor
and did not have a full Item_ref::fix_fields() call. Later
in PS/SP, after Item_ref::cleanup, we use this knowledge
to avoid doing full fix_fields() for items that were never
supposed to be fix_field'ed.
Simplify the test case.
Diffstat (limited to 'sql/item.cc')
-rw-r--r-- | sql/item.cc | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/sql/item.cc b/sql/item.cc index 9b3e9a546c6..878c9604ca2 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -6754,7 +6754,7 @@ Item_ref::Item_ref(Name_resolution_context *context_arg, /* This constructor used to create some internals references over fixed items */ - if (ref && *ref && (*ref)->fixed) + if ((set_properties_only= (ref && *ref && (*ref)->fixed))) set_properties(); } @@ -6798,7 +6798,7 @@ Item_ref::Item_ref(TABLE_LIST *view_arg, Item **item, /* This constructor is used to create some internal references over fixed items */ - if (ref && *ref && (*ref)->fixed) + if ((set_properties_only= (ref && *ref && (*ref)->fixed))) set_properties(); } @@ -6873,7 +6873,11 @@ bool Item_ref::fix_fields(THD *thd, Item **reference) DBUG_ASSERT(fixed == 0); SELECT_LEX *current_sel= thd->lex->current_select; - if (!ref || ref == not_found_item) + if (set_properties_only) + { + /* do nothing */ + } + else if (!ref || ref == not_found_item) { DBUG_ASSERT(reference_trough_name != 0); if (!(ref= resolve_ref_in_select_and_group(thd, this, |