From 43e879c717952fa84e2914609a13b8f05da2daba Mon Sep 17 00:00:00 2001 From: Nikita Malyavin Date: Wed, 24 Mar 2021 01:02:26 +0300 Subject: MDEV-24583 SELECT aborts after failed REPLACE into table with vcol table->move_fields wasn't undone in case of error. 1. move_fields is unconditionally undone even when error is occurred 2. cherry-pick an assertion in `ptr_in_record`, which is already in 10.5 --- sql/sql_insert.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'sql/sql_insert.cc') diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index ec79ff6d688..90cf8782d48 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -1753,9 +1753,10 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info) in handler methods for the just read row in record[1]. */ table->move_fields(table->field, table->record[1], table->record[0]); - if (table->update_virtual_fields(table->file, VCOL_UPDATE_FOR_REPLACE)) - goto err; + int verr = table->update_virtual_fields(table->file, VCOL_UPDATE_FOR_REPLACE); table->move_fields(table->field, table->record[0], table->record[1]); + if (verr) + goto err; } if (info->handle_duplicates == DUP_UPDATE) { -- cgit v1.2.1