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 3483c9381e8..458c921e01b 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -8343,7 +8343,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) @@ -8362,9 +8362,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; + /* Update virtual fields */ if (table_arg->vfield && table_arg->update_virtual_fields(table_arg->file, VCOL_UPDATE_FOR_WRITE)) @@ -8554,7 +8558,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; @@ -8585,10 +8588,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++; @@ -8617,11 +8617,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->vfield && |