diff options
author | Dmitry Shulga <dmitry.shulga@mariadb.com> | 2022-12-15 21:19:56 +0700 |
---|---|---|
committer | Dmitry Shulga <dmitry.shulga@mariadb.com> | 2022-12-15 21:19:56 +0700 |
commit | e7d2a50c3490a102dea580fd54dd760eeabe7906 (patch) | |
tree | 3e2294ec7fc93aa9a83cd4bb54c7ffc96029cdaf /sql/sp_instr.cc | |
parent | f89cf1cf4bb89cadfc997f08be7b6b26fbe9d40d (diff) | |
download | mariadb-git-10.11-MDEV-5816-1.tar.gz |
MDEV-5816: Stored programs: validation of stored program statements10.11-MDEV-5816-1
This is the follow-up to the commit i943b463cfaa303845a298d50a5c757cba6ab05e4
that fixes the issue with NEW/OLD pseudo-column in re-comipling SP statement.
Diffstat (limited to 'sql/sp_instr.cc')
-rw-r--r-- | sql/sp_instr.cc | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/sql/sp_instr.cc b/sql/sp_instr.cc index 4e62f7892fc..5714a08d250 100644 --- a/sql/sp_instr.cc +++ b/sql/sp_instr.cc @@ -695,12 +695,13 @@ LEX* sp_lex_instr::parse_expr(THD *thd, sp_head *sp) if (!parsing_failed) { thd->lex->set_trg_event_type_for_tables(); + adjust_sql_command(thd->lex); + parsing_failed= on_after_expr_parsing(thd); + if (sp->m_handler->type() == SP_TYPE_TRIGGER) setup_table_fields_for_trigger(thd, sp, saved_ptr_to_next_trg_items_list); - adjust_sql_command(thd->lex); - parsing_failed= on_after_expr_parsing(thd); /* Assign the list of items created on parsing to the current stored routine instruction. @@ -1057,6 +1058,27 @@ sp_instr_set_trigger_field::print(String *str) } +bool sp_instr_set_trigger_field::on_after_expr_parsing(THD *thd) +{ + DBUG_ASSERT(thd->lex->current_select->item_list.elements == 1); + + value= thd->lex->current_select->item_list.head(); + DBUG_ASSERT(value != nullptr); + + trigger_field = new (thd->mem_root) + Item_trigger_field(thd, thd->lex->current_context(), + Item_trigger_field::NEW_ROW, + m_trigger_field_name, UPDATE_ACL, false); + + if (!value || !trigger_field) + return true; + + thd->spcont->m_sp->m_cur_instr_trig_field_items.link_in_list( + trigger_field, &trigger_field->next_trg_field); + + return false; +} + /* sp_instr_jump class functions |