Commit 8c169f5e authored by Dmitry Shulga's avatar Dmitry Shulga

MDEV-28220: Assert failure in sp_head::~sp_head on parsing a syntax incorrect...

MDEV-28220: Assert failure in sp_head::~sp_head on parsing a syntax incorrect statement CREATE SEQUENCE ... RESTART inside CREATE PROCEDURE/CREATE FUNCTION

This bug report is about the same issue as MDEV-28129 and MDEV-21173.
The issue is that the macros YYABORT is called instead of MYSQL_YYABORT
on parse error. In result the method LEX::cleanup_lex_after_parse_error
is not called to clean up data structures created on parsing of
the statement.
parent 49aee1a1
......@@ -8921,4 +8921,17 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
BEGIN
RETURN '';
END' at line 2
#
# MDEV-28220: Assert failure in sp_head::~sp_head on parsing a syntax incorrect statement CREATE SEQUENCE ... RESTART inside CREATE PROCEDURE/CREATE FUNCTION
# Specifying the RESTART clause for the statement CREATE SEQUENCE is a syntax error.
# Check that CREATE PROCEDURE doesn't crash server if the statement
# CREATE SEQUNCE ... RESTART is specified in its body.
#
CREATE PROCEDURE sp1() CREATE SEQUENCE s1 START WITH 300 INCREMENT BY 30 RESTART;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'RESTART' at line 1
# CREATE SEQUNCE ... RESTART and CREATE SEQUNCE ... RESTART WITH ... are
# handled by different grammar rules, so check the both cases.
CREATE PROCEDURE sp1() CREATE SEQUENCE s1 START WITH 300 INCREMENT BY 30 RESTART WITH 100;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'RESTART' at line 1
# End of 10.3 tests
......@@ -10474,4 +10474,19 @@ END;
$$
DELIMITER ;$$
--echo #
--echo # MDEV-28220: Assert failure in sp_head::~sp_head on parsing a syntax incorrect statement CREATE SEQUENCE ... RESTART inside CREATE PROCEDURE/CREATE FUNCTION
--echo
--echo # Specifying the RESTART clause for the statement CREATE SEQUENCE is a syntax error.
--echo # Check that CREATE PROCEDURE doesn't crash server if the statement
--echo # CREATE SEQUNCE ... RESTART is specified in its body.
--echo #
--error ER_PARSE_ERROR
CREATE PROCEDURE sp1() CREATE SEQUENCE s1 START WITH 300 INCREMENT BY 30 RESTART;
--echo # CREATE SEQUNCE ... RESTART and CREATE SEQUNCE ... RESTART WITH ... are
--echo # handled by different grammar rules, so check the both cases.
--error ER_PARSE_ERROR
CREATE PROCEDURE sp1() CREATE SEQUENCE s1 START WITH 300 INCREMENT BY 30 RESTART WITH 100;
--echo # End of 10.3 tests
......@@ -3037,7 +3037,7 @@ sequence_def:
if (unlikely(Lex->sql_command != SQLCOM_ALTER_SEQUENCE))
{
thd->parse_error(ER_SYNTAX_ERROR, "RESTART");
YYABORT;
MYSQL_YYABORT;
}
if (unlikely(Lex->create_info.seq_create_info->used_fields &
seq_field_used_restart))
......@@ -3049,7 +3049,7 @@ sequence_def:
if (unlikely(Lex->sql_command != SQLCOM_ALTER_SEQUENCE))
{
thd->parse_error(ER_SYNTAX_ERROR, "RESTART");
YYABORT;
MYSQL_YYABORT;
}
if (unlikely(Lex->create_info.seq_create_info->used_fields &
seq_field_used_restart))
......
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