mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
MDEV-10201 Bad results for CREATE TABLE t1 (a INT DEFAULT b, b INT DEFAULT 4)
Optionally do table->update_default_fields() even for INSERT that supposedly provides values for all column. Because these "values" might be DEFAULT, which would need table->update_default_fields() at the end. Also set Item_default_value::used_tables() from the default expression. Non-zero used_field() means that mysql_insert() will initialize all fields to their default values (with restore_record()) even if all columns are later provided with values. Because default expressions may refer to other columns and they must be initialized.
This commit is contained in:
@ -991,6 +991,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
|
||||
share->default_values[share->null_bytes - 1];
|
||||
}
|
||||
}
|
||||
table->reset_default_fields();
|
||||
if (fill_record_n_invoke_before_triggers(thd, table,
|
||||
table->field_to_fill(),
|
||||
*values, 0, TRG_EVENT_INSERT))
|
||||
|
Reference in New Issue
Block a user