1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-9428 NO_AUTO_VALUE_ON_ZERO is ignored when a trigger before insert is defined

Don't compare "field == table->next_number_field" because the field
can be special nullable field copy created by the trigger.
Compare field_index values instead.
This commit is contained in:
Sergei Golubchik
2016-01-23 20:40:01 +01:00
parent 68910e7092
commit 5da7c346c7
3 changed files with 31 additions and 1 deletions

View File

@ -8962,6 +8962,9 @@ fill_record(THD *thd, TABLE *table, Field **ptr, List<Item> &values,
Item *value;
Field *field;
bool abort_on_warning_saved= thd->abort_on_warning;
uint autoinc_index= table->next_number_field
? table->next_number_field->field_index
: ~0U;
DBUG_ENTER("fill_record");
if (!*ptr)
@ -8987,7 +8990,7 @@ fill_record(THD *thd, TABLE *table, Field **ptr, List<Item> &values,
DBUG_ASSERT(field->table == table);
value=v++;
if (field == table->next_number_field)
if (field->field_index == autoinc_index)
table->auto_increment_field_not_null= TRUE;
if (field->vcol_info &&
value->type() != Item::DEFAULT_VALUE_ITEM &&