summaryrefslogtreecommitdiff
path: root/storage/innobase/row/row0ins.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-09-21 11:04:04 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2020-09-21 11:04:04 +0300
commitcbcb4ecabbb82a09794d825ca246d64e3d4b2c8c (patch)
treeb8fab11441c9080cbd3574a26c3eee10df58aaed /storage/innobase/row/row0ins.cc
parentade782c001affa69df80ed51e807e16198a9fe04 (diff)
parent69d536a22dc1988e89697c55549fc3c272fbbf2c (diff)
downloadmariadb-git-cbcb4ecabbb82a09794d825ca246d64e3d4b2c8c.tar.gz
Merge 10.2 into 10.3
Diffstat (limited to 'storage/innobase/row/row0ins.cc')
-rw-r--r--storage/innobase/row/row0ins.cc41
1 files changed, 18 insertions, 23 deletions
diff --git a/storage/innobase/row/row0ins.cc b/storage/innobase/row/row0ins.cc
index f25e9648a32..4c355881ca1 100644
--- a/storage/innobase/row/row0ins.cc
+++ b/storage/innobase/row/row0ins.cc
@@ -911,8 +911,6 @@ row_ins_foreign_fill_virtual(
&ext, cascade->heap);
n_diff = update->n_fields;
- update->n_fields += n_v_fld;
-
if (index->table->vc_templ == NULL) {
/** This can occur when there is a cascading
delete or update after restart. */
@@ -945,7 +943,7 @@ row_ins_foreign_fill_virtual(
return DB_COMPUTE_VALUE_FAILED;
}
- upd_field = upd_get_nth_field(update, n_diff);
+ upd_field = update->fields + n_diff;
upd_field->old_v_val = static_cast<dfield_t*>(
mem_heap_alloc(cascade->heap,
@@ -955,30 +953,27 @@ row_ins_foreign_fill_virtual(
upd_field_set_v_field_no(upd_field, i, index);
- if (node->is_delete
- ? (foreign->type & DICT_FOREIGN_ON_DELETE_SET_NULL)
- : (foreign->type & DICT_FOREIGN_ON_UPDATE_SET_NULL)) {
-
- dfield_set_null(&upd_field->new_val);
- }
-
- if (!node->is_delete
- && (foreign->type & DICT_FOREIGN_ON_UPDATE_CASCADE)) {
-
- dfield_t* new_vfield = innobase_get_computed_value(
- update->old_vrow, col, index,
- &vc.heap, update->heap, NULL, thd,
- mysql_table, record, NULL,
- node->update, foreign);
+ bool set_null =
+ node->is_delete
+ ? (foreign->type & DICT_FOREIGN_ON_DELETE_SET_NULL)
+ : (foreign->type & DICT_FOREIGN_ON_UPDATE_SET_NULL);
- if (new_vfield == NULL) {
- return DB_COMPUTE_VALUE_FAILED;
- }
+ dfield_t* new_vfield = innobase_get_computed_value(
+ update->old_vrow, col, index,
+ &vc.heap, update->heap, NULL, thd,
+ mysql_table, record, NULL,
+ set_null ? update : node->update, foreign);
- dfield_copy(&(upd_field->new_val), new_vfield);
+ if (new_vfield == NULL) {
+ return DB_COMPUTE_VALUE_FAILED;
}
- n_diff++;
+ dfield_copy(&upd_field->new_val, new_vfield);
+
+ if (!dfield_datas_are_binary_equal(
+ upd_field->old_v_val,
+ &upd_field->new_val, 0))
+ n_diff++;
}
update->n_fields = n_diff;