diff options
| author | Nikita Malyavin <nikitamalyavin@gmail.com> | 2021-03-24 01:02:26 +0300 |
|---|---|---|
| committer | Nikita Malyavin <nikitamalyavin@gmail.com> | 2021-04-08 17:56:31 +0300 |
| commit | 365cc8e5fd86d522b620436359793bea62c7567e (patch) | |
| tree | 061830eceec4b85d89c1d8eee309ce3c7135e73a /sql | |
| parent | 6e7e772d780b23066307c307c45c552f5bf3d5dd (diff) | |
| download | mariadb-git-bb-10.2-purge-debug-sync.tar.gz | |
MDEV-24583 SELECT aborts after failed REPLACE into table with vcolbb-10.2-purge-debug-sync
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
Diffstat (limited to 'sql')
| -rw-r--r-- | sql/field.h | 5 | ||||
| -rw-r--r-- | sql/sql_insert.cc | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/sql/field.h b/sql/field.h index 18e44f1d9d4..f63fb670211 100644 --- a/sql/field.h +++ b/sql/field.h @@ -972,8 +972,9 @@ public: virtual void reset_fields() {} const uchar *ptr_in_record(const uchar *record) const { - my_ptrdiff_t l_offset= (my_ptrdiff_t) (record - table->record[0]); - return ptr + l_offset; + my_ptrdiff_t l_offset= (my_ptrdiff_t) (ptr - table->record[0]); + DBUG_ASSERT(l_offset >= 0 && table->s->rec_buff_length - l_offset > 0); + return record + l_offset; } virtual int set_default(); 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) { |
