summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2016-11-19 16:23:33 +0100
committerSergei Golubchik <serg@mariadb.org>2016-12-12 20:27:39 +0100
commit94462aa9e6dbe71ac49192553e9fcd130d470c3a (patch)
treecd55b05f9391c6819dbb12aa1e957bca323b3c76
parent56c1f8da4bff7c627eb0807c7cb34bebd0d7b291 (diff)
downloadmariadb-git-94462aa9e6dbe71ac49192553e9fcd130d470c3a.tar.gz
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
-rw-r--r--sql/sql_base.cc9
-rw-r--r--sql/sql_insert.cc2
-rw-r--r--sql/sql_lex.cc1
-rw-r--r--sql/sql_lex.h7
-rw-r--r--sql/sql_load.cc2
-rw-r--r--sql/table.cc1
-rw-r--r--sql/table.h1
7 files changed, 2 insertions, 21 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index a3790043f9f..f1dd1781eba 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -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);
Item *value, *fld;
Item_field *field;
- TABLE *vcol_table= 0;
bool save_abort_on_warning= thd->abort_on_warning;
bool save_no_errors= thd->no_errors;
DBUG_ENTER("fill_record");
@@ -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;
f.rewind();
}
- else
- vcol_table= thd->lex->unit.insert_table_with_stored_vcol;
while ((fld= f++))
{
@@ -7822,8 +7819,6 @@ fill_record(THD *thd, TABLE *table_arg, List<Item> &fields, List<Item> &values,
goto err;
}
rfield->set_explicit_default(value);
- DBUG_ASSERT(vcol_table == 0 || vcol_table == table);
- vcol_table= table;
}
if (!update && table_arg->default_field &&
@@ -7831,8 +7826,8 @@ fill_record(THD *thd, TABLE *table_arg, List<Item> &fields, List<Item> &values,
goto err;
/* Update virtual fields */
thd->abort_on_warning= FALSE;
- if (vcol_table && vcol_table->vfield &&
- vcol_table->update_virtual_fields(VCOL_UPDATE_FOR_WRITE))
+ if (table_arg->vfield &&
+ table_arg->update_virtual_fields(VCOL_UPDATE_FOR_WRITE))
goto err;
thd->abort_on_warning= save_abort_on_warning;
thd->no_errors= save_no_errors;
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index b2a5617d743..003fe4f5366 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -1522,8 +1522,6 @@ bool mysql_prepare_insert(THD *thd, TABLE_LIST *table_list,
if (!table)
table= table_list->table;
- if (table->s->has_virtual_stored_fields)
- thd->lex->unit.insert_table_with_stored_vcol= table;
if (!select_insert)
{
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 357032ed449..45a6bf59b99 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -2074,7 +2074,6 @@ void st_select_lex_unit::init_query()
item_list.empty();
describe= 0;
found_rows_for_union= 0;
- insert_table_with_stored_vcol= 0;
derived= 0;
is_view= false;
with_clause= 0;
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index 4a554ae7fe2..63e0f7487ec 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -682,13 +682,6 @@ public:
bool describe; /* union exec() called for EXPLAIN */
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;
void init_query();
diff --git a/sql/sql_load.cc b/sql/sql_load.cc
index 7ade7a64470..509df96e89d 100644
--- a/sql/sql_load.cc
+++ b/sql/sql_load.cc
@@ -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->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;
bool use_blobs= 0, use_vars= 0;
diff --git a/sql/table.cc b/sql/table.cc
index 7d14f961721..eb4efd5c38a 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -2231,7 +2231,6 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
DBUG_ASSERT(!reg_field->vcol_info);
reg_field->vcol_info= vcol_info;
share->virtual_fields++;
- share->has_virtual_stored_fields=true; // For insert/load data
break;
case 2: // Default expression
vcol_info->stored_in_db= 1;
diff --git a/sql/table.h b/sql/table.h
index 344655ebbbc..e49f47d5d08 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -685,7 +685,6 @@ struct TABLE_SHARE
bool table_creation_was_logged;
bool non_determinstic_insert;
bool vcols_need_refixing;
- bool has_virtual_stored_fields;
bool check_set_initialized;
bool has_update_default_function;
ulong table_map_id; /* for row-based replication */