mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +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:
@ -5082,6 +5082,25 @@ connection default;
|
||||
SET GLOBAL disconnect_on_expired_password=@disconnect_on_expired_password_save;
|
||||
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 # End of 10.4 tests
|
||||
--echo #
|
||||
|
Reference in New Issue
Block a user