diff options
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r-- | sql/sql_base.cc | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc index a111acf30ad..19f472e0280 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -8502,7 +8502,7 @@ fill_record(THD *thd, TABLE *table_arg, List<Item> &fields, List<Item> &values, rfield->move_field_offset((my_ptrdiff_t) (table->record[1] - table->record[0])); } - rfield->set_explicit_default(value); + rfield->set_has_explicit_value(); } if (update && thd->variables.sql_mode & MODE_SIMULTANEOUS_ASSIGNMENT) @@ -8521,9 +8521,13 @@ fill_record(THD *thd, TABLE *table_arg, List<Item> &fields, List<Item> &values, } } - if (!update && table_arg->default_field && - table_arg->update_default_fields(0, ignore_errors)) - goto err; + if (update) + table_arg->evaluate_update_default_function(); + else + if (table_arg->default_field && + table_arg->update_default_fields(ignore_errors)) + goto err; + if (table_arg->versioned() && !only_unvers_fields) table_arg->vers_update_fields(); /* Update virtual fields */ @@ -8713,7 +8717,6 @@ fill_record(THD *thd, TABLE *table, Field **ptr, List<Item> &values, { List_iterator_fast<Item> v(values); List<TABLE> tbl_list; - bool all_fields_have_values= true; Item *value; Field *field; bool abort_on_warning_saved= thd->abort_on_warning; @@ -8744,10 +8747,7 @@ fill_record(THD *thd, TABLE *table, Field **ptr, List<Item> &values, DBUG_ASSERT(field->table == table); if (unlikely(field->invisible)) - { - all_fields_have_values= false; continue; - } else value=v++; @@ -8776,11 +8776,8 @@ fill_record(THD *thd, TABLE *table, Field **ptr, List<Item> &values, else if (value->save_in_field(field, 0) < 0) goto err; - all_fields_have_values &= field->set_explicit_default(value); + field->set_has_explicit_value(); } - if (!all_fields_have_values && table->default_field && - table->update_default_fields(0, ignore_errors)) - goto err; /* Update virtual fields */ thd->abort_on_warning= FALSE; if (table->versioned()) |