mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
MDEV-21173: Assertion `m_thd == __null' failed in sp_head::~sp_head
Some SQL statements that involves subqueries or stored routines could fail since execution of subqueries or stored routines is not supported for theses statements. Unfortunately, parsing error could result in abnormal termination by firing the following assert DBUG_ASSERT(m_thd == NULL); in a destructor of the class sp_head. The reason of the assert firing is that the method sp_head::restore_thd_mem_root() is not called on semantic action code to clean up resources allocated during parsing. This happens since the macros YYABORT is called instead of MYSQL_YYABORT by semantic action code for some grammar rules. So, to fix the bug YYABORT was just replaced with MYSQL_YYABORT.
This commit is contained in:
@ -5650,5 +5650,18 @@ connection default;
|
|||||||
SET GLOBAL disconnect_on_expired_password=@disconnect_on_expired_password_save;
|
SET GLOBAL disconnect_on_expired_password=@disconnect_on_expired_password_save;
|
||||||
DROP USER user1@localhost;
|
DROP USER user1@localhost;
|
||||||
#
|
#
|
||||||
|
# MDEV-21173: Assertion `m_thd == __null' failed in sp_head::~sp_head
|
||||||
|
#
|
||||||
|
CREATE TABLE t1 (a INT);
|
||||||
|
EXECUTE IMMEDIATE "CREATE PROCEDURE p1() SELECT 1 FROM t1 PROCEDURE ANALYSE( 10, (SELECT a FROM t1));";
|
||||||
|
ERROR 42000: PROCEDURE does not support subqueries or stored functions
|
||||||
|
DROP TABLE t1;
|
||||||
|
BEGIN NOT ATOMIC
|
||||||
|
PREPARE stmt FROM 'SELECT ?';
|
||||||
|
EXECUTE stmt USING ((SELECT 1));
|
||||||
|
END;
|
||||||
|
$
|
||||||
|
ERROR 42000: EXECUTE..USING does not support subqueries or stored functions
|
||||||
|
#
|
||||||
# End of 10.4 tests
|
# End of 10.4 tests
|
||||||
#
|
#
|
||||||
|
@ -5082,6 +5082,25 @@ connection default;
|
|||||||
SET GLOBAL disconnect_on_expired_password=@disconnect_on_expired_password_save;
|
SET GLOBAL disconnect_on_expired_password=@disconnect_on_expired_password_save;
|
||||||
DROP USER user1@localhost;
|
DROP USER user1@localhost;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-21173: Assertion `m_thd == __null' failed in sp_head::~sp_head
|
||||||
|
--echo #
|
||||||
|
CREATE TABLE t1 (a INT);
|
||||||
|
|
||||||
|
--error ER_SUBQUERIES_NOT_SUPPORTED
|
||||||
|
EXECUTE IMMEDIATE "CREATE PROCEDURE p1() SELECT 1 FROM t1 PROCEDURE ANALYSE( 10, (SELECT a FROM t1));";
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
delimiter $;
|
||||||
|
--error ER_SUBQUERIES_NOT_SUPPORTED
|
||||||
|
BEGIN NOT ATOMIC
|
||||||
|
PREPARE stmt FROM 'SELECT ?';
|
||||||
|
EXECUTE stmt USING ((SELECT 1));
|
||||||
|
END;
|
||||||
|
$
|
||||||
|
|
||||||
|
delimiter ;$
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
--echo # End of 10.4 tests
|
--echo # End of 10.4 tests
|
||||||
--echo #
|
--echo #
|
||||||
|
@ -8916,5 +8916,11 @@ END;
|
|||||||
$$
|
$$
|
||||||
ERROR 42000: Incorrect usage/placement of 'HIGH_PRIORITY'
|
ERROR 42000: Incorrect usage/placement of 'HIGH_PRIORITY'
|
||||||
#
|
#
|
||||||
|
# MDEV-21173: Assertion `m_thd == __null' failed in sp_head::~sp_head
|
||||||
|
#
|
||||||
|
CREATE TABLE t1 (a INT);
|
||||||
|
CREATE PROCEDURE p1() SELECT 1 FROM t1 PROCEDURE ANALYSE( 10, (SELECT a FROM t1));
|
||||||
|
ERROR 42000: PROCEDURE does not support subqueries or stored functions
|
||||||
|
DROP TABLE t1;
|
||||||
# End of 10.4 tests
|
# End of 10.4 tests
|
||||||
#
|
#
|
||||||
|
@ -10481,7 +10481,14 @@ END;
|
|||||||
$$
|
$$
|
||||||
DELIMITER ;$$
|
DELIMITER ;$$
|
||||||
|
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
|
--echo # MDEV-21173: Assertion `m_thd == __null' failed in sp_head::~sp_head
|
||||||
|
--echo #
|
||||||
|
CREATE TABLE t1 (a INT);
|
||||||
|
--error ER_SUBQUERIES_NOT_SUPPORTED
|
||||||
|
CREATE PROCEDURE p1() SELECT 1 FROM t1 PROCEDURE ANALYSE( 10, (SELECT a FROM t1));
|
||||||
|
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
--echo # End of 10.4 tests
|
--echo # End of 10.4 tests
|
||||||
--echo #
|
--echo #
|
||||||
|
@ -9610,7 +9610,7 @@ subselect:
|
|||||||
query_expression
|
query_expression
|
||||||
{
|
{
|
||||||
if (!($$= Lex->parsed_subselect($1)))
|
if (!($$= Lex->parsed_subselect($1)))
|
||||||
YYABORT;
|
MYSQL_YYABORT;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
@ -9655,14 +9655,14 @@ subquery:
|
|||||||
else
|
else
|
||||||
$1->fake_select_lex->braces= false;
|
$1->fake_select_lex->braces= false;
|
||||||
if (!($$= Lex->parsed_subselect($1)))
|
if (!($$= Lex->parsed_subselect($1)))
|
||||||
YYABORT;
|
MYSQL_YYABORT;
|
||||||
}
|
}
|
||||||
| '(' with_clause query_expression_no_with_clause ')'
|
| '(' with_clause query_expression_no_with_clause ')'
|
||||||
{
|
{
|
||||||
$3->set_with_clause($2);
|
$3->set_with_clause($2);
|
||||||
$2->attach_to($3->first_select());
|
$2->attach_to($3->first_select());
|
||||||
if (!($$= Lex->parsed_subselect($3)))
|
if (!($$= Lex->parsed_subselect($3)))
|
||||||
YYABORT;
|
MYSQL_YYABORT;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user