mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge
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