Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MDEV-26048: Table 'test._test_new' doesn't exist when add trigger (use pt-osc) #1872

Open
wants to merge 2 commits into
base: 10.2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions sql/sql_base.cc
Expand Up @@ -4420,10 +4420,9 @@ handle_table(THD *thd, Query_tables_list *prelocking_ctx,
{
if (table_list->table->triggers)
{
*need_prelocking= TRUE;

if (table_list->table->triggers->
add_tables_and_routines_for_triggers(thd, prelocking_ctx, table_list))
add_tables_and_routines_for_triggers(thd, prelocking_ctx, table_list,need_prelocking))
return TRUE;
}
if (table_list->table->file->referenced_by_foreign_key())
Expand Down
3 changes: 2 additions & 1 deletion sql/sql_trigger.cc
Expand Up @@ -2237,7 +2237,7 @@ bool
Table_triggers_list::
add_tables_and_routines_for_triggers(THD *thd,
Query_tables_list *prelocking_ctx,
TABLE_LIST *table_list)
TABLE_LIST *table_list,bool *need_prelocking)
{
DBUG_ASSERT(static_cast<int>(table_list->lock_type) >=
static_cast<int>(TL_WRITE_ALLOW_WRITE));
Expand All @@ -2253,6 +2253,7 @@ add_tables_and_routines_for_triggers(THD *thd,

for ( ; triggers ; triggers= triggers->next)
{
*need_prelocking = TRUE;
sp_head *trigger= triggers->body;

if (!triggers->body) // Parse error
Expand Down
2 changes: 1 addition & 1 deletion sql/sql_trigger.h
Expand Up @@ -269,7 +269,7 @@ class Table_triggers_list: public Sql_alloc

bool add_tables_and_routines_for_triggers(THD *thd,
Query_tables_list *prelocking_ctx,
TABLE_LIST *table_list);
TABLE_LIST *table_list,bool *need_prelocking);

Field **nullable_fields() { return record0_field; }
void reset_extra_null_bitmap()
Expand Down