From 17ab02f4b0537de321a281f47dec825a6368d483 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 2 Sep 2019 10:53:46 +0200 Subject: cleanup: on update default now * remove one level of virtual functions * remove redundant checks * remove an if() as the value is always known at compilation time don't pretend that "DEFAULT expr" and "ON UPDATE DEFAULT NOW" are "basically the same thing" --- sql/sql_insert.cc | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'sql/sql_insert.cc') diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 78564f28c31..550851bd215 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -1796,10 +1796,7 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info) be updated as if this is an UPDATE. */ if (different_records && table->default_field) - { - if (table->update_default_fields(1, info->ignore)) - goto err; - } + table->evaluate_update_default_function(); /* CHECK OPTION for VIEW ... ON DUPLICATE KEY UPDATE ... */ res= info->table_list->view_check_option(table->in_use, info->ignore); @@ -3762,7 +3759,7 @@ int select_insert::send_data(List &values) thd->count_cuted_fields= CHECK_FIELD_WARN; // Calculate cuted fields store_values(values); - if (table->default_field && table->update_default_fields(0, info.ignore)) + if (table->default_field && table->update_default_fields(info.ignore)) DBUG_RETURN(1); thd->count_cuted_fields= CHECK_FIELD_ERROR_FOR_NULL; if (thd->is_error()) -- cgit v1.2.1