summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sql/mysql_priv.h8
-rw-r--r--sql/sql_lex.h1
-rw-r--r--sql/table.cc2
3 files changed, 10 insertions, 1 deletions
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index 29b6aa88740..5f91e767c97 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -679,6 +679,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:
This subquery has fields from outer query (put by user)
@@ -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)
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index 6fc1167235c..d109ebfdcc8 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -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));
}
diff --git a/sql/table.cc b/sql/table.cc
index 0451c47eeb8..5548c220897 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -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;