diff options
author | Sergei Golubchik <serg@mariadb.org> | 2016-12-30 13:03:47 +0100 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2017-02-13 18:12:04 +0100 |
commit | cd4dd2b62dda31a4ea1da99ca6732ecb7ee0d628 (patch) | |
tree | de21f02863d5dfe94b65b92211f3c730216d9068 /sql/sql_insert.cc | |
parent | 588eca31e3c60a6778e59e618717396eb5293ebe (diff) | |
download | mariadb-git-cd4dd2b62dda31a4ea1da99ca6732ecb7ee0d628.tar.gz |
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.
Diffstat (limited to 'sql/sql_insert.cc')
-rw-r--r-- | sql/sql_insert.cc | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 1e9de5a039a..8e8f6c7a26f 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -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)) |