1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Merge branch '10.4' into 10.5

This commit is contained in:
Oleksandr Byelkin
2022-02-01 20:33:04 +01:00
460 changed files with 9909 additions and 2408 deletions

View File

@ -292,7 +292,7 @@ class Deprecated_trigger_syntax_handler : public Internal_error_handler
private:
char m_message[MYSQL_ERRMSG_SIZE];
LEX_CSTRING *m_trigger_name;
const LEX_CSTRING *m_trigger_name;
public:
@ -308,8 +308,23 @@ public:
if (sql_errno != EE_OUTOFMEMORY &&
sql_errno != ER_OUT_OF_RESOURCES)
{
// Check if the current LEX contains a non-empty spname
if(thd->lex->spname)
m_trigger_name= &thd->lex->spname->m_name;
else if (thd->lex->sphead)
{
/*
Some SP statements, for example IF, create their own local LEX.
All LEX instances are available in the LEX stack in sphead::m_lex.
Let's find the one that contains a non-zero spname.
Note, although a parse error has happened, the LEX instances
in sphead::m_lex are not freed yet at this point. The first
found non-zero spname contains the valid trigger name.
*/
const sp_name *spname= thd->lex->sphead->find_spname_recursive();
if (spname)
m_trigger_name= &spname->m_name;
}
if (m_trigger_name)
my_snprintf(m_message, sizeof(m_message),
ER_THD(thd, ER_ERROR_IN_TRIGGER_BODY),
@ -322,7 +337,7 @@ public:
return false;
}
LEX_CSTRING *get_trigger_name() { return m_trigger_name; }
const LEX_CSTRING *get_trigger_name() { return m_trigger_name; }
char *get_error_message() { return m_message; }
};
@ -1527,7 +1542,7 @@ bool Table_triggers_list::check_n_load(THD *thd, const LEX_CSTRING *db,
if (unlikely(parse_error))
{
LEX_CSTRING *name;
const LEX_CSTRING *name;
/*
In case of errors, disable all triggers for the table, but keep