summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2019-09-02 14:14:57 +0200
committerSergei Golubchik <serg@mariadb.org>2019-09-03 20:34:30 +0200
commit3789692d17625780b546bf2ec4a33acf5badae2c (patch)
treedf75cc89df82c83c3261c2a78192d63a66d22377
parent17ab02f4b0537de321a281f47dec825a6368d483 (diff)
downloadmariadb-git-3789692d17625780b546bf2ec4a33acf5badae2c.tar.gz
don't compare unassigned columns
on UPDATE, compare_record() was comparing all columns that are marked for writing. But generated columns that are written to the table are always deterministic and cannot change unless normal non-generated columns were changed. So it's enough to compare only non-generated columns that were explicitly assigned values in the SET clause.
-rw-r--r--sql/sql_update.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 4f129eb995a..0d55fa58bde 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -76,7 +76,7 @@ bool compare_record(const TABLE *table)
for (Field **ptr= table->field ; *ptr != NULL; ptr++)
{
Field *field= *ptr;
- if (bitmap_is_set(table->write_set, field->field_index))
+ if (field->has_explicit_value() && !field->vcol_info)
{
if (field->real_maybe_null())
{
@@ -108,8 +108,9 @@ bool compare_record(const TABLE *table)
/* Compare updated fields */
for (Field **ptr= table->field ; *ptr ; ptr++)
{
- if (bitmap_is_set(table->write_set, (*ptr)->field_index) &&
- (*ptr)->cmp_binary_offset(table->s->rec_buff_length))
+ Field *field= *ptr;
+ if (field->has_explicit_value() && !field->vcol_info &&
+ field->cmp_binary_offset(table->s->rec_buff_length))
return TRUE;
}
return FALSE;