From c02d6164fbdd5effe758a61d9bb709c581fefef1 Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Sat, 15 Jun 2019 14:46:25 +0300 Subject: MDEV-19771 REPLACE on table with virtual_field can cause crash Fixes also MDEV-17837 Problem was that we did not ignore warnings from virtual fields when updated virtual fields for to-be-replaced row. --- sql/sql_insert.cc | 3 +++ 1 file changed, 3 insertions(+) (limited to 'sql/sql_insert.cc') diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 2502be7e454..e2e7454803b 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -1747,12 +1747,15 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info) } if (table->vfield) { + my_bool abort_on_warning= thd->abort_on_warning; /* We have not yet called update_virtual_fields(VOL_UPDATE_FOR_READ) in handler methods for the just read row in record[1]. */ table->move_fields(table->field, table->record[1], table->record[0]); + thd->abort_on_warning= 0; table->update_virtual_fields(table->file, VCOL_UPDATE_FOR_REPLACE); + thd->abort_on_warning= abort_on_warning; table->move_fields(table->field, table->record[0], table->record[1]); } if (info->handle_duplicates == DUP_UPDATE) -- cgit v1.2.1