summaryrefslogtreecommitdiff
path: root/sql/handler.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2019-02-27 12:34:26 -0500
committerSergei Golubchik <serg@mariadb.org>2019-02-27 23:27:43 -0500
commit304f0084ef86b712358393b3b673e88612320957 (patch)
treea20c3da1470fd53bd84cbc456447a932d3844464 /sql/handler.cc
parentf78c0f6f0006600c30b5be3e201c72627c8b1a17 (diff)
downloadmariadb-git-304f0084ef86b712358393b3b673e88612320957.tar.gz
MDEV-18720 Assertion `inited==NONE' failed in ha_index_init upon update on versioned table with key on blob
* update system versioning fields before generaled columns * don't presume that ha_write_row() means INSERT. It could still be UPDATE * use the correct handler in check_duplicate_long_entry_key()
Diffstat (limited to 'sql/handler.cc')
-rw-r--r--sql/handler.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/sql/handler.cc b/sql/handler.cc
index 418d600cb1f..532ecc84621 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -6548,7 +6548,7 @@ static int check_duplicate_long_entry_key(TABLE *table, handler *h,
}
}
}
- while (!is_same && !(result= table->file->ha_index_next_same(table->check_unique_buf,
+ while (!is_same && !(result= h->ha_index_next_same(table->check_unique_buf,
ptr, key_info->key_length)));
if (is_same)
error= HA_ERR_FOUND_DUPP_KEY;
@@ -6651,9 +6651,12 @@ int handler::ha_write_row(uchar *buf)
mark_trx_read_write();
increment_statistics(&SSV::ha_write_count);
- if (table->s->long_unique_table &&
- (error= check_duplicate_long_entries(table, table->file, buf)))
- DBUG_RETURN(error);
+ if (table->s->long_unique_table)
+ {
+ handler *h= table->update_handler ? table->update_handler : table->file;
+ if ((error= check_duplicate_long_entries(table, h, buf)))
+ DBUG_RETURN(error);
+ }
TABLE_IO_WAIT(tracker, m_psi, PSI_TABLE_WRITE_ROW, MAX_KEY, 0,
{ error= write_row(buf); })