mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Merge
mysql-test/r/create.result: Auto merged mysql-test/r/ctype_latin1_de.result: Auto merged mysql-test/r/grant.result: Auto merged mysql-test/r/grant2.result: Auto merged mysql-test/r/limit.result: Auto merged mysql-test/r/order_by.result: Auto merged mysql-test/r/rpl000001.result: Auto merged mysql-test/r/sp.result: Auto merged mysql-test/r/strict.result: Auto merged mysql-test/r/type_blob.result: Auto merged mysql-test/r/type_ranges.result: Auto merged mysql-test/r/warnings.result: Auto merged mysql-test/t/ctype_latin1_de.test: Auto merged mysql-test/t/limit.test: Auto merged mysql-test/t/order_by.test: Auto merged mysql-test/t/show_check.test: Auto merged mysql-test/t/sp.test: Auto merged mysql-test/t/type_blob.test: Auto merged mysql-test/t/type_ranges.test: Auto merged sql/item.cc: Auto merged sql/item.h: Auto merged sql/sql_insert.cc: Auto merged mysql-test/t/strict.test: SCCS merged
This commit is contained in:
@@ -313,7 +313,8 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
|
||||
(MODE_STRICT_TRANS_TABLES |
|
||||
MODE_STRICT_ALL_TABLES)));
|
||||
|
||||
if (fields.elements && check_that_all_fields_are_given_values(thd, table))
|
||||
if ((fields.elements || !value_count) &&
|
||||
check_that_all_fields_are_given_values(thd, table))
|
||||
{
|
||||
/* thd->net.report_error is now set, which will abort the next loop */
|
||||
error= 1;
|
||||
@@ -885,19 +886,20 @@ err:
|
||||
|
||||
int check_that_all_fields_are_given_values(THD *thd, TABLE *entry)
|
||||
{
|
||||
if (!thd->abort_on_warning) // No check if not strict mode
|
||||
return 0;
|
||||
|
||||
int err= 0;
|
||||
for (Field **field=entry->field ; *field ; field++)
|
||||
{
|
||||
if ((*field)->query_id != thd->query_id &&
|
||||
((*field)->flags & NO_DEFAULT_VALUE_FLAG))
|
||||
{
|
||||
my_error(ER_NO_DEFAULT_FOR_FIELD, MYF(0), (*field)->field_name);
|
||||
return 1;
|
||||
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||
ER_NO_DEFAULT_FOR_FIELD,
|
||||
ER(ER_NO_DEFAULT_FOR_FIELD),
|
||||
(*field)->field_name);
|
||||
err= 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return thd->abort_on_warning ? err : 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
|
Reference in New Issue
Block a user