summaryrefslogtreecommitdiff
path: root/sql/table.cc
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2013-08-15 14:04:20 -0700
committerIgor Babaev <igor@askmonty.org>2013-08-15 14:04:20 -0700
commit960720b10dc463a73214786302f009356c2284ce (patch)
treee9c7748d0625f14a4c3a2a1d328b2ff0cace1990 /sql/table.cc
parentf1b4718ec894664df221704bb70fed80bdc14070 (diff)
parent7ba78277b4d76649501e85f05be2780e00ffc9c3 (diff)
downloadmariadb-git-960720b10dc463a73214786302f009356c2284ce.tar.gz
Merge 5.2->5.3
Diffstat (limited to 'sql/table.cc')
-rw-r--r--sql/table.cc16
1 files changed, 12 insertions, 4 deletions
diff --git a/sql/table.cc b/sql/table.cc
index 7c5f9ac82cb..9e1c53f7b22 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -1801,7 +1801,7 @@ bool fix_vcol_expr(THD *thd,
bool result= TRUE;
TABLE_LIST tables;
TABLE_LIST *save_table_list, *save_first_table, *save_last_table;
- int error;
+ int error= 0;
Name_resolution_context *context;
const char *save_where;
char* db_name;
@@ -1849,9 +1849,17 @@ 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;
+ if (!func_expr->fixed)
+ {
+ thd->lex->context_analysis_only|= CONTEXT_ANALYSIS_ONLY_VCOL_EXPR;
+ error= func_expr->fix_fields(thd, &vcol_info->expr_item);
+ thd->lex->context_analysis_only&= ~CONTEXT_ANALYSIS_ONLY_VCOL_EXPR;
+ }
+
+ /* fix_fields could change the expression */
+ func_expr= vcol_info->expr_item;
+ /* Number of columns will be checked later */
+
/* Restore the original context*/
thd->lex->use_only_table_context= save_use_only_table_context;
context->table_list= save_table_list;