Commit 2999492c authored by Oleksandr Byelkin's avatar Oleksandr Byelkin

MDEV-16036: Debug assertion failed in resignal on create temporary table

Reising condition on NOTW controlled by OPTION_SQL_NOTES.
parent b26736cd
......@@ -8731,3 +8731,38 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
DROP FUNCTION f1;
#
# MDEV-16036: Debug assertion failed in resignal on create
# temporary table
#
set @save_sql_mode= @@sql_mode;
set sql_mode='ORACLE';
CREATE or replace procedure p4()
AS
CONTINUE HANDLER FOR SQLWARNING
BEGIN
NULL;
END;
EXIT HANDLER FOR OTHERS -- SQLEXCEPTION
BEGIN
GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE, @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
SELECT @sqlstate, @errno, @text;
SHOW WARNINGS;
RESIGNAL; -- cause DBG_ASSERT failed
END;
BEGIN
CREATE TEMPORARY TABLE IF NOT EXISTS t1(origine VARCHAR2(10) NOT NULL);
END
/
call p4();
call p4();
@sqlstate @errno @text
42S01 1050 Table 't1' already exists
Level Code Message
Note 1050 Table 't1' already exists
Warnings:
Note 1050 Table 't1' already exists
drop procedure p4;
drop table t1;
set @@sql_mode=@save_sql_mode;
# End of 10.3 tests
......@@ -10252,3 +10252,37 @@ CREATE TABLE t1 AS SELECT f1() AS c1, COALESCE(f1()) AS c2, CONCAT(f1()) AS c3;
SHOW CREATE TABLE t1;
DROP TABLE t1;
DROP FUNCTION f1;
--echo #
--echo # MDEV-16036: Debug assertion failed in resignal on create
--echo # temporary table
--echo #
set @save_sql_mode= @@sql_mode;
set sql_mode='ORACLE';
delimiter /;
CREATE or replace procedure p4()
AS
CONTINUE HANDLER FOR SQLWARNING
BEGIN
NULL;
END;
EXIT HANDLER FOR OTHERS -- SQLEXCEPTION
BEGIN
GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE, @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
SELECT @sqlstate, @errno, @text;
SHOW WARNINGS;
RESIGNAL; -- cause DBG_ASSERT failed
END;
BEGIN
CREATE TEMPORARY TABLE IF NOT EXISTS t1(origine VARCHAR2(10) NOT NULL);
END
/
delimiter ;/
call p4();
call p4();
drop procedure p4;
drop table t1;
set @@sql_mode=@save_sql_mode;
--echo # End of 10.3 tests
......@@ -343,13 +343,15 @@ bool Sql_cmd_common_signal::raise_condition(THD *thd, Sql_condition *cond)
if (eval_signal_informations(thd, cond))
DBUG_RETURN(result);
/* SIGNAL should not signal WARN_LEVEL_NOTE */
DBUG_ASSERT((cond->m_level == Sql_condition::WARN_LEVEL_WARN) ||
(cond->m_level == Sql_condition::WARN_LEVEL_ERROR));
/* SIGNAL should not signal WARN_LEVEL_NOTE, but RESIGNAL can */
DBUG_ASSERT(cond->m_level == Sql_condition::WARN_LEVEL_ERROR ||
cond->m_level != Sql_condition::WARN_LEVEL_NOTE ||
sql_command_code() == SQLCOM_RESIGNAL);
(void) thd->raise_condition(cond);
if (cond->m_level == Sql_condition::WARN_LEVEL_WARN)
if (cond->m_level == Sql_condition::WARN_LEVEL_WARN ||
cond->m_level == Sql_condition::WARN_LEVEL_NOTE)
{
my_ok(thd);
result= FALSE;
......
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