diff --git a/mysql-test/suite/sql_sequence/alter.result b/mysql-test/suite/sql_sequence/alter.result index 90de2ebfcc0..68d42e52784 100644 --- a/mysql-test/suite/sql_sequence/alter.result +++ b/mysql-test/suite/sql_sequence/alter.result @@ -210,8 +210,12 @@ create table t1 (a int); alter sequence t1 minvalue=100; ERROR 42S02: 'test.t1' is not a SEQUENCE drop table t1; +# +# MDEV-32795: ALTER SEQUENCE IF NOT EXISTS non_existing_seq Errors rather than note +# alter sequence if exists t1 minvalue=100; -ERROR 42S02: Unknown SEQUENCE: 't1' +Warnings: +Note 4091 Unknown SEQUENCE: 'test.t1' alter sequence t1 minvalue=100; ERROR 42S02: Unknown SEQUENCE: 't1' create sequence t1; diff --git a/mysql-test/suite/sql_sequence/alter.test b/mysql-test/suite/sql_sequence/alter.test index e6bbaba614a..a771c9bba2f 100644 --- a/mysql-test/suite/sql_sequence/alter.test +++ b/mysql-test/suite/sql_sequence/alter.test @@ -120,8 +120,12 @@ create table t1 (a int); alter sequence t1 minvalue=100; drop table t1; ---error ER_UNKNOWN_SEQUENCES +--echo # +--echo # MDEV-32795: ALTER SEQUENCE IF NOT EXISTS non_existing_seq Errors rather than note +--echo # + alter sequence if exists t1 minvalue=100; + --error ER_UNKNOWN_SEQUENCES alter sequence t1 minvalue=100; diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 627dc6ff5f6..4e8598a8d65 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -77,7 +77,9 @@ No_such_table_error_handler::handle_condition(THD *, Sql_condition ** cond_hdl) { *cond_hdl= NULL; - if (sql_errno == ER_NO_SUCH_TABLE || sql_errno == ER_NO_SUCH_TABLE_IN_ENGINE) + if (sql_errno == ER_NO_SUCH_TABLE + || sql_errno == ER_NO_SUCH_TABLE_IN_ENGINE + || sql_errno == ER_UNKNOWN_SEQUENCES) { m_handled_errors++; return TRUE; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 0b893c952bd..f6f826e3e07 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -8128,11 +8128,7 @@ alter: | ALTER SEQUENCE_SYM opt_if_exists { LEX *lex= Lex; - lex->name= null_clex_str; - lex->table_type= TABLE_TYPE_UNKNOWN; lex->sql_command= SQLCOM_ALTER_SEQUENCE; - lex->create_info.init(); - lex->no_write_to_binlog= 0; DBUG_ASSERT(!lex->m_sql_cmd); if (Lex->main_select_push()) MYSQL_YYABORT;