1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-07 06:01:31 +03:00

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.
This commit is contained in:
Sergei Golubchik
2019-09-02 14:14:57 +02:00
parent 17ab02f4b0
commit 3789692d17

View File

@ -76,7 +76,7 @@ bool compare_record(const TABLE *table)
for (Field **ptr= table->field ; *ptr != NULL; ptr++) for (Field **ptr= table->field ; *ptr != NULL; ptr++)
{ {
Field *field= *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()) if (field->real_maybe_null())
{ {
@ -108,8 +108,9 @@ bool compare_record(const TABLE *table)
/* Compare updated fields */ /* Compare updated fields */
for (Field **ptr= table->field ; *ptr ; ptr++) for (Field **ptr= table->field ; *ptr ; ptr++)
{ {
if (bitmap_is_set(table->write_set, (*ptr)->field_index) && Field *field= *ptr;
(*ptr)->cmp_binary_offset(table->s->rec_buff_length)) if (field->has_explicit_value() && !field->vcol_info &&
field->cmp_binary_offset(table->s->rec_buff_length))
return TRUE; return TRUE;
} }
return FALSE; return FALSE;