Commit 8ce2e1bc authored by Igor Babaev's avatar Igor Babaev

Fixed the abort failure of a test case from vcol.vcol_misc.

The fix blocks execution of any constant sub-expressions of
the defining expressions for virtual columns when context
analysis if these expressions is performed.

Fixed a compiler warning.
parent 1e1755be
......@@ -678,6 +678,12 @@ enabled by default, add OPTIMIZER_SWITCH_MATERIALIZATION
*/
#define CONTEXT_ANALYSIS_ONLY_DERIVED 4
/*
Don't evaluate constant sub-expressions of virtual column
expressions when opening tables
*/
#define CONTEXT_ANALYSIS_ONLY_VCOL_EXPR 8
/*
Uncachable causes:
......@@ -1095,7 +1101,7 @@ struct Query_cache_query_flags
#define query_cache_resize(A) do { } while(0)
#define query_cache_set_min_res_unit(A) do { } while(0)
#define query_cache_invalidate3(A, B, C) do { } while(0)
#define query_cache_invalidate1(A) do { } while(0)
#define query_cache_invalidate1(A,B) do { } while(0)
#define query_cache_send_result_to_client(A, B, C) 0
#define query_cache_invalidate_by_MyISAM_filename_ref NULL
#define query_cache_abort(A) do { } while(0)
......
......@@ -1885,6 +1885,7 @@ typedef struct st_lex : public Query_tables_list
{
return (context_analysis_only &
(CONTEXT_ANALYSIS_ONLY_PREPARE |
CONTEXT_ANALYSIS_ONLY_VCOL_EXPR |
CONTEXT_ANALYSIS_ONLY_VIEW));
}
......
......@@ -1840,7 +1840,9 @@ bool fix_vcol_expr(THD *thd,
save_use_only_table_context= thd->lex->use_only_table_context;
thd->lex->use_only_table_context= TRUE;
/* Fix fields referenced to by the virtual column function */
thd->lex->context_analysis_only|= CONTEXT_ANALYSIS_ONLY_VCOL_EXPR;
error= func_expr->fix_fields(thd, (Item**)0);
thd->lex->context_analysis_only&= ~CONTEXT_ANALYSIS_ONLY_VCOL_EXPR;
/* Restore the original context*/
thd->lex->use_only_table_context= save_use_only_table_context;
context->table_list= save_table_list;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment