Commit 94462aa9 authored by Sergei Golubchik's avatar Sergei Golubchik

bugfix: remove broken insert t values () optimization

* wrong results for 5.7 and 10.1- vcols, and for indexed vcols
* only helps in rare cases and only minimally
parent 56c1f8da
...@@ -7762,7 +7762,6 @@ fill_record(THD *thd, TABLE *table_arg, List<Item> &fields, List<Item> &values, ...@@ -7762,7 +7762,6 @@ fill_record(THD *thd, TABLE *table_arg, List<Item> &fields, List<Item> &values,
List_iterator_fast<Item> f(fields),v(values); List_iterator_fast<Item> f(fields),v(values);
Item *value, *fld; Item *value, *fld;
Item_field *field; Item_field *field;
TABLE *vcol_table= 0;
bool save_abort_on_warning= thd->abort_on_warning; bool save_abort_on_warning= thd->abort_on_warning;
bool save_no_errors= thd->no_errors; bool save_no_errors= thd->no_errors;
DBUG_ENTER("fill_record"); DBUG_ENTER("fill_record");
...@@ -7788,8 +7787,6 @@ fill_record(THD *thd, TABLE *table_arg, List<Item> &fields, List<Item> &values, ...@@ -7788,8 +7787,6 @@ fill_record(THD *thd, TABLE *table_arg, List<Item> &fields, List<Item> &values,
table_arg->auto_increment_field_not_null= FALSE; table_arg->auto_increment_field_not_null= FALSE;
f.rewind(); f.rewind();
} }
else
vcol_table= thd->lex->unit.insert_table_with_stored_vcol;
while ((fld= f++)) while ((fld= f++))
{ {
...@@ -7822,8 +7819,6 @@ fill_record(THD *thd, TABLE *table_arg, List<Item> &fields, List<Item> &values, ...@@ -7822,8 +7819,6 @@ fill_record(THD *thd, TABLE *table_arg, List<Item> &fields, List<Item> &values,
goto err; goto err;
} }
rfield->set_explicit_default(value); rfield->set_explicit_default(value);
DBUG_ASSERT(vcol_table == 0 || vcol_table == table);
vcol_table= table;
} }
if (!update && table_arg->default_field && if (!update && table_arg->default_field &&
...@@ -7831,8 +7826,8 @@ fill_record(THD *thd, TABLE *table_arg, List<Item> &fields, List<Item> &values, ...@@ -7831,8 +7826,8 @@ fill_record(THD *thd, TABLE *table_arg, List<Item> &fields, List<Item> &values,
goto err; goto err;
/* Update virtual fields */ /* Update virtual fields */
thd->abort_on_warning= FALSE; thd->abort_on_warning= FALSE;
if (vcol_table && vcol_table->vfield && if (table_arg->vfield &&
vcol_table->update_virtual_fields(VCOL_UPDATE_FOR_WRITE)) table_arg->update_virtual_fields(VCOL_UPDATE_FOR_WRITE))
goto err; goto err;
thd->abort_on_warning= save_abort_on_warning; thd->abort_on_warning= save_abort_on_warning;
thd->no_errors= save_no_errors; thd->no_errors= save_no_errors;
......
...@@ -1522,8 +1522,6 @@ bool mysql_prepare_insert(THD *thd, TABLE_LIST *table_list, ...@@ -1522,8 +1522,6 @@ bool mysql_prepare_insert(THD *thd, TABLE_LIST *table_list,
if (!table) if (!table)
table= table_list->table; table= table_list->table;
if (table->s->has_virtual_stored_fields)
thd->lex->unit.insert_table_with_stored_vcol= table;
if (!select_insert) if (!select_insert)
{ {
......
...@@ -2074,7 +2074,6 @@ void st_select_lex_unit::init_query() ...@@ -2074,7 +2074,6 @@ void st_select_lex_unit::init_query()
item_list.empty(); item_list.empty();
describe= 0; describe= 0;
found_rows_for_union= 0; found_rows_for_union= 0;
insert_table_with_stored_vcol= 0;
derived= 0; derived= 0;
is_view= false; is_view= false;
with_clause= 0; with_clause= 0;
......
...@@ -682,13 +682,6 @@ class st_select_lex_unit: public st_select_lex_node { ...@@ -682,13 +682,6 @@ class st_select_lex_unit: public st_select_lex_node {
bool describe; /* union exec() called for EXPLAIN */ bool describe; /* union exec() called for EXPLAIN */
Procedure *last_procedure; /* Pointer to procedure, if such exists */ Procedure *last_procedure; /* Pointer to procedure, if such exists */
/*
Insert table with stored virtual columns.
This is used only in those rare cases
when the list of inserted values is empty.
*/
TABLE *insert_table_with_stored_vcol;
bool columns_are_renamed; bool columns_are_renamed;
void init_query(); void init_query();
......
...@@ -410,8 +410,6 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, ...@@ -410,8 +410,6 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
table->prepare_triggers_for_insert_stmt_or_event(); table->prepare_triggers_for_insert_stmt_or_event();
table->mark_columns_needed_for_insert(); table->mark_columns_needed_for_insert();
if (table->s->has_virtual_stored_fields)
thd->lex->unit.insert_table_with_stored_vcol= table;
uint tot_length=0; uint tot_length=0;
bool use_blobs= 0, use_vars= 0; bool use_blobs= 0, use_vars= 0;
......
...@@ -2231,7 +2231,6 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, ...@@ -2231,7 +2231,6 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
DBUG_ASSERT(!reg_field->vcol_info); DBUG_ASSERT(!reg_field->vcol_info);
reg_field->vcol_info= vcol_info; reg_field->vcol_info= vcol_info;
share->virtual_fields++; share->virtual_fields++;
share->has_virtual_stored_fields=true; // For insert/load data
break; break;
case 2: // Default expression case 2: // Default expression
vcol_info->stored_in_db= 1; vcol_info->stored_in_db= 1;
......
...@@ -685,7 +685,6 @@ struct TABLE_SHARE ...@@ -685,7 +685,6 @@ struct TABLE_SHARE
bool table_creation_was_logged; bool table_creation_was_logged;
bool non_determinstic_insert; bool non_determinstic_insert;
bool vcols_need_refixing; bool vcols_need_refixing;
bool has_virtual_stored_fields;
bool check_set_initialized; bool check_set_initialized;
bool has_update_default_function; bool has_update_default_function;
ulong table_map_id; /* for row-based replication */ ulong table_map_id; /* for row-based replication */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment