summaryrefslogtreecommitdiff
path: root/sql/sql_base.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-07-31 18:09:08 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2020-07-31 18:09:08 +0300
commit9216114ce729733e6b0c4ce952bfdf57595ff387 (patch)
tree7a541ed87a6a8174d3d94c5f780724a34e08dc1c /sql/sql_base.cc
parentdc513dff911d72eaaf9f752f390fef8d1ef9a4b0 (diff)
parent66ec3a770f7854f500ece66c78f3c87c9cd6da15 (diff)
downloadmariadb-git-9216114ce729733e6b0c4ce952bfdf57595ff387.tar.gz
Merge 10.3 into 10.4
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r--sql/sql_base.cc43
1 files changed, 26 insertions, 17 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 551e4286d8b..10bc6ccab6c 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -5430,6 +5430,24 @@ static void mark_real_tables_as_free_for_reuse(TABLE_LIST *table_list)
}
}
+int TABLE::fix_vcol_exprs(THD *thd)
+{
+ for (Field **vf= vfield; vf && *vf; vf++)
+ if (fix_session_vcol_expr(thd, (*vf)->vcol_info))
+ return 1;
+
+ for (Field **df= default_field; df && *df; df++)
+ if ((*df)->default_value &&
+ fix_session_vcol_expr(thd, (*df)->default_value))
+ return 1;
+
+ for (Virtual_column_info **cc= check_constraints; cc && *cc; cc++)
+ if (fix_session_vcol_expr(thd, (*cc)))
+ return 1;
+
+ return 0;
+}
+
static bool fix_all_session_vcol_exprs(THD *thd, TABLE_LIST *tables)
{
@@ -5437,36 +5455,27 @@ static bool fix_all_session_vcol_exprs(THD *thd, TABLE_LIST *tables)
TABLE_LIST *first_not_own= thd->lex->first_not_own_table();
DBUG_ENTER("fix_session_vcol_expr");
- for (TABLE_LIST *table= tables; table && table != first_not_own;
+ int error= 0;
+ for (TABLE_LIST *table= tables; table && table != first_not_own && !error;
table= table->next_global)
{
TABLE *t= table->table;
if (!table->placeholder() && t->s->vcols_need_refixing &&
table->lock_type >= TL_WRITE_ALLOW_WRITE)
{
+ Query_arena *stmt_backup= thd->stmt_arena;
+ if (thd->stmt_arena->is_conventional())
+ thd->stmt_arena= t->expr_arena;
if (table->security_ctx)
thd->security_ctx= table->security_ctx;
- for (Field **vf= t->vfield; vf && *vf; vf++)
- if (fix_session_vcol_expr(thd, (*vf)->vcol_info))
- goto err;
-
- for (Field **df= t->default_field; df && *df; df++)
- if ((*df)->default_value &&
- fix_session_vcol_expr(thd, (*df)->default_value))
- goto err;
-
- for (Virtual_column_info **cc= t->check_constraints; cc && *cc; cc++)
- if (fix_session_vcol_expr(thd, (*cc)))
- goto err;
+ error= t->fix_vcol_exprs(thd);
thd->security_ctx= save_security_ctx;
+ thd->stmt_arena= stmt_backup;
}
}
- DBUG_RETURN(0);
-err:
- thd->security_ctx= save_security_ctx;
- DBUG_RETURN(1);
+ DBUG_RETURN(error);
}