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

MDEV-34958: after Trigger doesn't work correctly with bulk insert

This bug has the same nature as the issues
  MDEV-34718: Trigger doesn't work correctly with bulk update
  MDEV-24411: Trigger doesn't work correctly with bulk insert

To fix the issue covering all use cases, resetting the thd->bulk_param
temporary to the value nullptr before invoking triggers and restoring
its original value on finishing execution of a trigger is moved to the method
  Table_triggers_list::process_triggers
that be invoked ultimately for any kind of triggers.
This commit is contained in:
Dmitry Shulga
2024-12-13 09:29:23 +07:00
parent 0b7fa4c267
commit 54c1031b74
6 changed files with 133 additions and 31 deletions

View File

@ -8784,22 +8784,13 @@ fill_record_n_invoke_before_triggers(THD *thd, TABLE *table,
if (!result && triggers)
{
void *save_bulk_param= thd->bulk_param;
/*
Reset the sentinel thd->bulk_param in order not to consume the next
values of a bound array in case one of statement executed by
the trigger's body is INSERT statement.
*/
thd->bulk_param= nullptr;
if (triggers->process_triggers(thd, event, TRG_ACTION_BEFORE,
TRUE) ||
not_null_fields_have_null_values(table))
{
thd->bulk_param= save_bulk_param;
return TRUE;
}
thd->bulk_param= save_bulk_param;
/*
Re-calculate virtual fields to cater for cases when base columns are