1
0
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:
Dmitry Shulga
2022-04-05 20:20:09 +07:00
parent c4ebb2bd04
commit f6b09a7ce5
5 changed files with 49 additions and 4 deletions

View File

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