1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-07 00:04:31 +03:00

MDEV-32795: ALTER SEQUENCE IF NOT EXISTS non_existing_seq Errors rather than note

Like all IF NOT EXISTS syntax, a Note should be generated.

The original commit of Seqeuences cleared the IF NOT EXISTS part
in the sql/sql_yacc.yy with lex->create_info.init(). Without this
bit set there was no way it could do anything other than error.

To remedy this removal, the sql_yacc.yy components have been
minimised as they where all set at the beginning of the ALTER.
This way the opt_if_not_exists correctly set the IF_EXISTS flag.

In MDEV-13005 (bb4dd70e7c) the error code changed, requiring
ER_UNKNOWN_SEQUENCES to be handled in the function
No_such_table_error_handler::handle_condition.
This commit is contained in:
Daniel Black
2023-11-14 10:01:08 +11:00
parent 7504985daf
commit fbe604d883
4 changed files with 13 additions and 7 deletions

View File

@@ -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;

View File

@@ -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;