mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Crash when giving error message for ALTER SEQUENCE
Fixes MDEV-14761 "Assertion `!mysql_parse_status || thd->is_error() || thd->get_internal_handler()' failed in parse_sql"
This commit is contained in:
@ -162,3 +162,12 @@ select next value for s1;
|
|||||||
ERROR HY000: Can't execute the query because you have a conflicting read lock
|
ERROR HY000: Can't execute the query because you have a conflicting read lock
|
||||||
unlock tables;
|
unlock tables;
|
||||||
drop sequence s1;
|
drop sequence s1;
|
||||||
|
#
|
||||||
|
# MDEV-14761
|
||||||
|
# Assertion `!mysql_parse_status || thd->is_error() ||
|
||||||
|
# thd->get_internal_handler()' failed in parse_sql
|
||||||
|
#
|
||||||
|
CREATE SEQUENCE s1;
|
||||||
|
ALTER SEQUENCE s1 MAXVALUE 100 NO MAXVALUE;
|
||||||
|
ERROR HY000: Option 'MAXVALUE' used twice in statement
|
||||||
|
DROP SEQUENCE s1;
|
||||||
|
@ -131,3 +131,14 @@ create sequence s2;
|
|||||||
select next value for s1;
|
select next value for s1;
|
||||||
unlock tables;
|
unlock tables;
|
||||||
drop sequence s1;
|
drop sequence s1;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-14761
|
||||||
|
--echo # Assertion `!mysql_parse_status || thd->is_error() ||
|
||||||
|
--echo # thd->get_internal_handler()' failed in parse_sql
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
CREATE SEQUENCE s1;
|
||||||
|
--error ER_DUP_ARGUMENT
|
||||||
|
ALTER SEQUENCE s1 MAXVALUE 100 NO MAXVALUE;
|
||||||
|
DROP SEQUENCE s1;
|
||||||
|
@ -2685,59 +2685,80 @@ sequence_def:
|
|||||||
| NO_SYM MINVALUE_SYM
|
| NO_SYM MINVALUE_SYM
|
||||||
{
|
{
|
||||||
if (Lex->create_info.seq_create_info->used_fields & seq_field_used_min_value)
|
if (Lex->create_info.seq_create_info->used_fields & seq_field_used_min_value)
|
||||||
MYSQL_YYABORT;
|
my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "MINVALUE"));
|
||||||
Lex->create_info.seq_create_info->used_fields|= seq_field_used_min_value;
|
Lex->create_info.seq_create_info->used_fields|= seq_field_used_min_value;
|
||||||
}
|
}
|
||||||
| NOMINVALUE_SYM
|
| NOMINVALUE_SYM
|
||||||
{
|
{
|
||||||
if (Lex->create_info.seq_create_info->used_fields & seq_field_used_min_value)
|
if (Lex->create_info.seq_create_info->used_fields & seq_field_used_min_value)
|
||||||
MYSQL_YYABORT;
|
my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "MINVALUE"));
|
||||||
Lex->create_info.seq_create_info->used_fields|= seq_field_used_min_value;
|
Lex->create_info.seq_create_info->used_fields|= seq_field_used_min_value;
|
||||||
}
|
}
|
||||||
| MAXVALUE_SYM opt_equal longlong_num
|
| MAXVALUE_SYM opt_equal longlong_num
|
||||||
{
|
{
|
||||||
|
if (Lex->create_info.seq_create_info->used_fields &
|
||||||
|
seq_field_used_max_value)
|
||||||
|
my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "MAXVALUE"));
|
||||||
Lex->create_info.seq_create_info->max_value= $3;
|
Lex->create_info.seq_create_info->max_value= $3;
|
||||||
Lex->create_info.seq_create_info->used_fields|= seq_field_used_max_value;
|
Lex->create_info.seq_create_info->used_fields|= seq_field_used_max_value;
|
||||||
}
|
}
|
||||||
| NO_SYM MAXVALUE_SYM
|
| NO_SYM MAXVALUE_SYM
|
||||||
{
|
{
|
||||||
if (Lex->create_info.seq_create_info->used_fields & seq_field_used_max_value)
|
if (Lex->create_info.seq_create_info->used_fields & seq_field_used_max_value)
|
||||||
MYSQL_YYABORT;
|
my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "MAXVALUE"));
|
||||||
Lex->create_info.seq_create_info->used_fields|= seq_field_used_max_value;
|
Lex->create_info.seq_create_info->used_fields|= seq_field_used_max_value;
|
||||||
}
|
}
|
||||||
| NOMAXVALUE_SYM
|
| NOMAXVALUE_SYM
|
||||||
{
|
{
|
||||||
if (Lex->create_info.seq_create_info->used_fields & seq_field_used_max_value)
|
if (Lex->create_info.seq_create_info->used_fields & seq_field_used_max_value)
|
||||||
MYSQL_YYABORT;
|
my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "MAXVALUE"));
|
||||||
Lex->create_info.seq_create_info->used_fields|= seq_field_used_max_value;
|
Lex->create_info.seq_create_info->used_fields|= seq_field_used_max_value;
|
||||||
}
|
}
|
||||||
| START_SYM opt_with longlong_num
|
| START_SYM opt_with longlong_num
|
||||||
{
|
{
|
||||||
|
if (Lex->create_info.seq_create_info->used_fields &
|
||||||
|
seq_field_used_start)
|
||||||
|
my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "START"));
|
||||||
Lex->create_info.seq_create_info->start= $3;
|
Lex->create_info.seq_create_info->start= $3;
|
||||||
Lex->create_info.seq_create_info->used_fields|= seq_field_used_start;
|
Lex->create_info.seq_create_info->used_fields|= seq_field_used_start;
|
||||||
}
|
}
|
||||||
| INCREMENT_SYM opt_by longlong_num
|
| INCREMENT_SYM opt_by longlong_num
|
||||||
{
|
{
|
||||||
|
if (Lex->create_info.seq_create_info->used_fields &
|
||||||
|
seq_field_used_increment)
|
||||||
|
my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "INCREMENT"));
|
||||||
Lex->create_info.seq_create_info->increment= $3;
|
Lex->create_info.seq_create_info->increment= $3;
|
||||||
Lex->create_info.seq_create_info->used_fields|= seq_field_used_increment;
|
Lex->create_info.seq_create_info->used_fields|= seq_field_used_increment;
|
||||||
}
|
}
|
||||||
| CACHE_SYM opt_equal longlong_num
|
| CACHE_SYM opt_equal longlong_num
|
||||||
{
|
{
|
||||||
|
if (Lex->create_info.seq_create_info->used_fields &
|
||||||
|
seq_field_used_cache)
|
||||||
|
my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "CACHE"));
|
||||||
Lex->create_info.seq_create_info->cache= $3;
|
Lex->create_info.seq_create_info->cache= $3;
|
||||||
Lex->create_info.seq_create_info->used_fields|= seq_field_used_cache;
|
Lex->create_info.seq_create_info->used_fields|= seq_field_used_cache;
|
||||||
}
|
}
|
||||||
| NOCACHE_SYM
|
| NOCACHE_SYM
|
||||||
{
|
{
|
||||||
|
if (Lex->create_info.seq_create_info->used_fields &
|
||||||
|
seq_field_used_cache)
|
||||||
|
my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "CACHE"));
|
||||||
Lex->create_info.seq_create_info->cache= 0;
|
Lex->create_info.seq_create_info->cache= 0;
|
||||||
Lex->create_info.seq_create_info->used_fields|= seq_field_used_cache;
|
Lex->create_info.seq_create_info->used_fields|= seq_field_used_cache;
|
||||||
}
|
}
|
||||||
| CYCLE_SYM
|
| CYCLE_SYM
|
||||||
{
|
{
|
||||||
|
if (Lex->create_info.seq_create_info->used_fields &
|
||||||
|
seq_field_used_cycle)
|
||||||
|
my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "CYCLE"));
|
||||||
Lex->create_info.seq_create_info->cycle= 1;
|
Lex->create_info.seq_create_info->cycle= 1;
|
||||||
Lex->create_info.seq_create_info->used_fields|= seq_field_used_cycle;
|
Lex->create_info.seq_create_info->used_fields|= seq_field_used_cycle;
|
||||||
}
|
}
|
||||||
| NOCYCLE_SYM
|
| NOCYCLE_SYM
|
||||||
{
|
{
|
||||||
|
if (Lex->create_info.seq_create_info->used_fields &
|
||||||
|
seq_field_used_cycle)
|
||||||
|
my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "CYCLE"));
|
||||||
Lex->create_info.seq_create_info->cycle= 0;
|
Lex->create_info.seq_create_info->cycle= 0;
|
||||||
Lex->create_info.seq_create_info->used_fields|= seq_field_used_cycle;
|
Lex->create_info.seq_create_info->used_fields|= seq_field_used_cycle;
|
||||||
}
|
}
|
||||||
@ -2748,6 +2769,9 @@ sequence_def:
|
|||||||
thd->parse_error(ER_SYNTAX_ERROR, "RESTART");
|
thd->parse_error(ER_SYNTAX_ERROR, "RESTART");
|
||||||
YYABORT;
|
YYABORT;
|
||||||
}
|
}
|
||||||
|
if (Lex->create_info.seq_create_info->used_fields &
|
||||||
|
seq_field_used_restart)
|
||||||
|
my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "RESTART"));
|
||||||
Lex->create_info.seq_create_info->used_fields|= seq_field_used_restart;
|
Lex->create_info.seq_create_info->used_fields|= seq_field_used_restart;
|
||||||
}
|
}
|
||||||
| RESTART_SYM opt_with longlong_num
|
| RESTART_SYM opt_with longlong_num
|
||||||
@ -2757,6 +2781,9 @@ sequence_def:
|
|||||||
thd->parse_error(ER_SYNTAX_ERROR, "RESTART");
|
thd->parse_error(ER_SYNTAX_ERROR, "RESTART");
|
||||||
YYABORT;
|
YYABORT;
|
||||||
}
|
}
|
||||||
|
if (Lex->create_info.seq_create_info->used_fields &
|
||||||
|
seq_field_used_restart)
|
||||||
|
my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "RESTART"));
|
||||||
Lex->create_info.seq_create_info->restart= $3;
|
Lex->create_info.seq_create_info->restart= $3;
|
||||||
Lex->create_info.seq_create_info->used_fields|= seq_field_used_restart | seq_field_used_restart_value;
|
Lex->create_info.seq_create_info->used_fields|= seq_field_used_restart | seq_field_used_restart_value;
|
||||||
}
|
}
|
||||||
|
@ -2121,59 +2121,80 @@ sequence_def:
|
|||||||
| NO_SYM MINVALUE_SYM
|
| NO_SYM MINVALUE_SYM
|
||||||
{
|
{
|
||||||
if (Lex->create_info.seq_create_info->used_fields & seq_field_used_min_value)
|
if (Lex->create_info.seq_create_info->used_fields & seq_field_used_min_value)
|
||||||
MYSQL_YYABORT;
|
my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "MINVALUE"));
|
||||||
Lex->create_info.seq_create_info->used_fields|= seq_field_used_min_value;
|
Lex->create_info.seq_create_info->used_fields|= seq_field_used_min_value;
|
||||||
}
|
}
|
||||||
| NOMINVALUE_SYM
|
| NOMINVALUE_SYM
|
||||||
{
|
{
|
||||||
if (Lex->create_info.seq_create_info->used_fields & seq_field_used_min_value)
|
if (Lex->create_info.seq_create_info->used_fields & seq_field_used_min_value)
|
||||||
MYSQL_YYABORT;
|
my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "MINVALUE"));
|
||||||
Lex->create_info.seq_create_info->used_fields|= seq_field_used_min_value;
|
Lex->create_info.seq_create_info->used_fields|= seq_field_used_min_value;
|
||||||
}
|
}
|
||||||
| MAXVALUE_SYM opt_equal longlong_num
|
| MAXVALUE_SYM opt_equal longlong_num
|
||||||
{
|
{
|
||||||
|
if (Lex->create_info.seq_create_info->used_fields &
|
||||||
|
seq_field_used_max_value)
|
||||||
|
my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "MAXVALUE"));
|
||||||
Lex->create_info.seq_create_info->max_value= $3;
|
Lex->create_info.seq_create_info->max_value= $3;
|
||||||
Lex->create_info.seq_create_info->used_fields|= seq_field_used_max_value;
|
Lex->create_info.seq_create_info->used_fields|= seq_field_used_max_value;
|
||||||
}
|
}
|
||||||
| NO_SYM MAXVALUE_SYM
|
| NO_SYM MAXVALUE_SYM
|
||||||
{
|
{
|
||||||
if (Lex->create_info.seq_create_info->used_fields & seq_field_used_max_value)
|
if (Lex->create_info.seq_create_info->used_fields & seq_field_used_max_value)
|
||||||
MYSQL_YYABORT;
|
my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "MAXVALUE"));
|
||||||
Lex->create_info.seq_create_info->used_fields|= seq_field_used_max_value;
|
Lex->create_info.seq_create_info->used_fields|= seq_field_used_max_value;
|
||||||
}
|
}
|
||||||
| NOMAXVALUE_SYM
|
| NOMAXVALUE_SYM
|
||||||
{
|
{
|
||||||
if (Lex->create_info.seq_create_info->used_fields & seq_field_used_max_value)
|
if (Lex->create_info.seq_create_info->used_fields & seq_field_used_max_value)
|
||||||
MYSQL_YYABORT;
|
my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "MAXVALUE"));
|
||||||
Lex->create_info.seq_create_info->used_fields|= seq_field_used_max_value;
|
Lex->create_info.seq_create_info->used_fields|= seq_field_used_max_value;
|
||||||
}
|
}
|
||||||
| START_SYM opt_with longlong_num
|
| START_SYM opt_with longlong_num
|
||||||
{
|
{
|
||||||
|
if (Lex->create_info.seq_create_info->used_fields &
|
||||||
|
seq_field_used_start)
|
||||||
|
my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "START"));
|
||||||
Lex->create_info.seq_create_info->start= $3;
|
Lex->create_info.seq_create_info->start= $3;
|
||||||
Lex->create_info.seq_create_info->used_fields|= seq_field_used_start;
|
Lex->create_info.seq_create_info->used_fields|= seq_field_used_start;
|
||||||
}
|
}
|
||||||
| INCREMENT_SYM opt_by longlong_num
|
| INCREMENT_SYM opt_by longlong_num
|
||||||
{
|
{
|
||||||
|
if (Lex->create_info.seq_create_info->used_fields &
|
||||||
|
seq_field_used_increment)
|
||||||
|
my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "INCREMENT"));
|
||||||
Lex->create_info.seq_create_info->increment= $3;
|
Lex->create_info.seq_create_info->increment= $3;
|
||||||
Lex->create_info.seq_create_info->used_fields|= seq_field_used_increment;
|
Lex->create_info.seq_create_info->used_fields|= seq_field_used_increment;
|
||||||
}
|
}
|
||||||
| CACHE_SYM opt_equal longlong_num
|
| CACHE_SYM opt_equal longlong_num
|
||||||
{
|
{
|
||||||
|
if (Lex->create_info.seq_create_info->used_fields &
|
||||||
|
seq_field_used_cache)
|
||||||
|
my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "CACHE"));
|
||||||
Lex->create_info.seq_create_info->cache= $3;
|
Lex->create_info.seq_create_info->cache= $3;
|
||||||
Lex->create_info.seq_create_info->used_fields|= seq_field_used_cache;
|
Lex->create_info.seq_create_info->used_fields|= seq_field_used_cache;
|
||||||
}
|
}
|
||||||
| NOCACHE_SYM
|
| NOCACHE_SYM
|
||||||
{
|
{
|
||||||
|
if (Lex->create_info.seq_create_info->used_fields &
|
||||||
|
seq_field_used_cache)
|
||||||
|
my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "CACHE"));
|
||||||
Lex->create_info.seq_create_info->cache= 0;
|
Lex->create_info.seq_create_info->cache= 0;
|
||||||
Lex->create_info.seq_create_info->used_fields|= seq_field_used_cache;
|
Lex->create_info.seq_create_info->used_fields|= seq_field_used_cache;
|
||||||
}
|
}
|
||||||
| CYCLE_SYM
|
| CYCLE_SYM
|
||||||
{
|
{
|
||||||
|
if (Lex->create_info.seq_create_info->used_fields &
|
||||||
|
seq_field_used_cycle)
|
||||||
|
my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "CYCLE"));
|
||||||
Lex->create_info.seq_create_info->cycle= 1;
|
Lex->create_info.seq_create_info->cycle= 1;
|
||||||
Lex->create_info.seq_create_info->used_fields|= seq_field_used_cycle;
|
Lex->create_info.seq_create_info->used_fields|= seq_field_used_cycle;
|
||||||
}
|
}
|
||||||
| NOCYCLE_SYM
|
| NOCYCLE_SYM
|
||||||
{
|
{
|
||||||
|
if (Lex->create_info.seq_create_info->used_fields &
|
||||||
|
seq_field_used_cycle)
|
||||||
|
my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "CYCLE"));
|
||||||
Lex->create_info.seq_create_info->cycle= 0;
|
Lex->create_info.seq_create_info->cycle= 0;
|
||||||
Lex->create_info.seq_create_info->used_fields|= seq_field_used_cycle;
|
Lex->create_info.seq_create_info->used_fields|= seq_field_used_cycle;
|
||||||
}
|
}
|
||||||
@ -2184,6 +2205,9 @@ sequence_def:
|
|||||||
thd->parse_error(ER_SYNTAX_ERROR, "RESTART");
|
thd->parse_error(ER_SYNTAX_ERROR, "RESTART");
|
||||||
YYABORT;
|
YYABORT;
|
||||||
}
|
}
|
||||||
|
if (Lex->create_info.seq_create_info->used_fields &
|
||||||
|
seq_field_used_restart)
|
||||||
|
my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "RESTART"));
|
||||||
Lex->create_info.seq_create_info->used_fields|= seq_field_used_restart;
|
Lex->create_info.seq_create_info->used_fields|= seq_field_used_restart;
|
||||||
}
|
}
|
||||||
| RESTART_SYM opt_with longlong_num
|
| RESTART_SYM opt_with longlong_num
|
||||||
@ -2193,6 +2217,9 @@ sequence_def:
|
|||||||
thd->parse_error(ER_SYNTAX_ERROR, "RESTART");
|
thd->parse_error(ER_SYNTAX_ERROR, "RESTART");
|
||||||
YYABORT;
|
YYABORT;
|
||||||
}
|
}
|
||||||
|
if (Lex->create_info.seq_create_info->used_fields &
|
||||||
|
seq_field_used_restart)
|
||||||
|
my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "RESTART"));
|
||||||
Lex->create_info.seq_create_info->restart= $3;
|
Lex->create_info.seq_create_info->restart= $3;
|
||||||
Lex->create_info.seq_create_info->used_fields|= seq_field_used_restart | seq_field_used_restart_value;
|
Lex->create_info.seq_create_info->used_fields|= seq_field_used_restart | seq_field_used_restart_value;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user