Commit 1c346084 authored by Alexander Barkov's avatar Alexander Barkov

MDEV-14404 Don't use LEX::check_exists in ALTER SEQUENCE

parent 7663773e
......@@ -387,13 +387,15 @@ class Sql_cmd_alter_table : public Sql_cmd_common_alter_table
/**
Sql_cmd_alter_sequence represents the ALTER SEQUENCE statement.
*/
class Sql_cmd_alter_sequence : public Sql_cmd
class Sql_cmd_alter_sequence : public Sql_cmd,
public DDL_options
{
public:
/**
Constructor, used to represent a ALTER TABLE statement.
*/
Sql_cmd_alter_sequence()
Sql_cmd_alter_sequence(const DDL_options &options)
:DDL_options(options)
{}
~Sql_cmd_alter_sequence()
......
......@@ -851,10 +851,10 @@ bool Sql_cmd_alter_sequence::execute(THD *thd)
if (check_grant(thd, ALTER_ACL, first_table, FALSE, UINT_MAX, FALSE))
DBUG_RETURN(TRUE); /* purecov: inspected */
if (lex->check_exists)
if (if_exists())
thd->push_internal_handler(&no_such_table_handler);
error= open_and_lock_tables(thd, first_table, FALSE, 0);
if (lex->check_exists)
if (if_exists())
{
trapped_errors= no_such_table_handler.safely_trapped_errors();
thd->pop_internal_handler();
......
......@@ -7314,7 +7314,7 @@ alter:
Lex->create_info.set($2);
Lex->sql_command= SQLCOM_ALTER_USER;
}
| ALTER SEQUENCE_SYM opt_if_exists_table_element
| ALTER SEQUENCE_SYM opt_if_exists
{
LEX *lex= Lex;
lex->name= null_clex_str;
......@@ -7337,7 +7337,7 @@ alter:
sequence_defs
{
/* Create a generic ALTER SEQUENCE statment. */
Lex->m_sql_cmd= new (thd->mem_root) Sql_cmd_alter_sequence();
Lex->m_sql_cmd= new (thd->mem_root) Sql_cmd_alter_sequence($3);
if (Lex->m_sql_cmd == NULL)
MYSQL_YYABORT;
}
......
......@@ -7301,7 +7301,7 @@ alter:
Lex->create_info.set($2);
Lex->sql_command= SQLCOM_ALTER_USER;
}
| ALTER SEQUENCE_SYM opt_if_exists_table_element
| ALTER SEQUENCE_SYM opt_if_exists
{
LEX *lex= Lex;
lex->name= null_clex_str;
......@@ -7324,7 +7324,7 @@ alter:
sequence_defs
{
/* Create a generic ALTER SEQUENCE statment. */
Lex->m_sql_cmd= new (thd->mem_root) Sql_cmd_alter_sequence();
Lex->m_sql_cmd= new (thd->mem_root) Sql_cmd_alter_sequence($3);
if (Lex->m_sql_cmd == NULL)
MYSQL_YYABORT;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment