From 56c1f8da4bff7c627eb0807c7cb34bebd0d7b291 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 16 Nov 2016 20:33:45 +0100 Subject: [PATCH] bugfix: table->get_fields_in_item_tree=true partitioning was setting subj as a partitioning-specific hack (GET_FIXED_FIELDS_FLAG field flag to detect partitioning fields) inside init_lex_with_single_table(). But vcols also use init_lex_with_single_table(), they run fix_fields() in open_table_from_share() before partitioning and this messes up partitioning GET_FIXED_FIELDS_FLAG logic. --- sql/sql_lex.cc | 1 - sql/sql_partition.cc | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 634b6d1a3b8..357032ed449 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -196,7 +196,6 @@ init_lex_with_single_table(THD *thd, TABLE *table, LEX *lex) lex->context_analysis_only|= CONTEXT_ANALYSIS_ONLY_VCOL_EXPR; select_lex->cur_pos_in_select_list= UNDEF_POS; table->map= 1; //To ensure correct calculation of const item - table->get_fields_in_item_tree= TRUE; table_list->table= table; table_list->cacheable_table= false; return FALSE; diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index 09dbf9d76af..972ab3aa1f1 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -936,6 +936,7 @@ static bool fix_fields_part_func(THD *thd, Item* func_expr, TABLE *table, if (init_lex_with_single_table(thd, table, &lex)) goto end; + table->get_fields_in_item_tree= true; func_expr->walk(&Item::change_context_processor, 0, &lex.select_lex.context); thd->where= "partition function";