1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

SQL: fill_record() field-value inconsistency fix [#365 bug 2]

Affected tests (forced mode): binlog_encryption.encrypted_slave
This commit is contained in:
Aleksey Midenkov
2017-11-28 22:56:01 +03:00
parent 47ea526efa
commit 8d548f8e86
6 changed files with 66 additions and 31 deletions

View File

@ -676,6 +676,23 @@ static void save_insert_query_plan(THD* thd, TABLE_LIST *table_list)
}
Field **TABLE::field_to_fill()
{
return triggers && triggers->nullable_fields() ? triggers->nullable_fields() : field;
}
inline
Field **TABLE::user_fields()
{
if (versioned())
{
return triggers && triggers->vers_user_fields() ? triggers->vers_user_fields() : vers_user_field;
}
return field_to_fill();
}
/**
INSERT statement implementation
@ -1002,7 +1019,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
}
table->reset_default_fields();
if (fill_record_n_invoke_before_triggers(thd, table,
table->field_to_fill(),
table->user_fields(),
*values, 0, TRG_EVENT_INSERT))
{
if (values_list.elements != 1 && ! thd->is_error())
@ -3875,7 +3892,7 @@ void select_insert::store_values(List<Item> &values)
fill_record_n_invoke_before_triggers(thd, table, *fields, values, 1,
TRG_EVENT_INSERT);
else
fill_record_n_invoke_before_triggers(thd, table, table->field_to_fill(),
fill_record_n_invoke_before_triggers(thd, table, table->user_fields(),
values, 1, TRG_EVENT_INSERT);
DBUG_VOID_RETURN;