1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00

In TRADITIONAL mode, don't allow a NOT NULL field with no default be set to

DEFAULT (with no argument) or to the field's type's default by not being
listed in the list of fields being inserted. (Bug #5986)                    


sql/item.cc:
  Add Item_default_value::save_in_field(), with check for setting fields
  with no default value set.
sql/item.h:
  Implementation of Item_default_value::save_in_field moved to item.cc
sql/sql_insert.cc:
  Call check_that_all_fields_are_given_values() if no values were
  given and we would be filling row with all default values
mysql-test/t/strict.test:
  Add tests for setting fields to DEFAULT in traditional and regular modes
mysql-test/r/strict.result:
  Add results
This commit is contained in:
unknown
2005-01-13 18:23:34 -08:00
parent fd7e0d847b
commit dcfc9c895a
5 changed files with 96 additions and 10 deletions

View File

@@ -311,7 +311,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;