1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

Merge 10.2 into 10.3

This commit is contained in:
Marko Mäkelä
2019-09-04 17:52:04 +03:00
33 changed files with 459 additions and 377 deletions

View File

@ -69,17 +69,20 @@ bool compare_record(const TABLE *table)
{
DBUG_ASSERT(records_are_comparable(table));
if ((table->file->ha_table_flags() & HA_PARTIAL_COLUMN_READ) != 0)
if (table->file->ha_table_flags() & HA_PARTIAL_COLUMN_READ ||
table->s->has_update_default_function)
{
/*
Storage engine may not have read all columns of the record. Fields
(including NULL bits) not in the write_set may not have been read and
can therefore not be compared.
Or ON UPDATE DEFAULT NOW() could've changed field values, including
NULL bits.
*/
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())
{
@ -111,8 +114,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;
@ -897,11 +901,6 @@ update_begin:
if (!can_compare_record || compare_record(table))
{
if (table->default_field && table->update_default_fields(1, ignore))
{
error= 1;
break;
}
if ((res= table_list->view_check_option(thd, ignore)) !=
VIEW_CHECK_OK)
{
@ -2379,10 +2378,6 @@ int multi_update::send_data(List<Item> &not_used_values)
{
int error;
if (table->default_field &&
unlikely(table->update_default_fields(1, ignore)))
DBUG_RETURN(1);
if ((error= cur_table->view_check_option(thd, ignore)) !=
VIEW_CHECK_OK)
{
@ -2699,6 +2694,10 @@ int multi_update::do_updates()
copy_field_ptr->to_field->set_has_explicit_value();
}
table->evaluate_update_default_function();
if (table->vfield &&
table->update_virtual_fields(table->file, VCOL_UPDATE_FOR_WRITE))
goto err2;
if (table->triggers &&
table->triggers->process_triggers(thd, TRG_EVENT_UPDATE,
TRG_ACTION_BEFORE, TRUE))
@ -2707,12 +2706,6 @@ int multi_update::do_updates()
if (!can_compare_record || compare_record(table))
{
int error;
if (table->default_field &&
(error= table->update_default_fields(1, ignore)))
goto err2;
if (table->vfield &&
table->update_virtual_fields(table->file, VCOL_UPDATE_FOR_WRITE))
goto err2;
if ((error= cur_table->view_check_option(thd, ignore)) !=
VIEW_CHECK_OK)
{