[MDEV-4924] Error 1645: RESIGNAL when handler not active Created: 2013-08-19  Updated: 2013-08-20  Resolved: 2013-08-20

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: 10.0.4
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Federico Razzoli Assignee: Unassigned
Resolution: Not a Bug Votes: 0
Labels: None


 Description   

RESIGNAL can only be used "when handler is active" (like the error message says). In 5.5, if a condition handler contains "CALL x()", then x() could contain a RESIGNAL, and it worked as expected. But in MariaDB 10 and MySQL 5.6, an error is produced at runtime:

Example:

SET @@session.SQL_MODE = 'ERROR_FOR_DIVISION_BY_ZERO,NO_ZERO_DATE,NO_ZERO_IN_DATE,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION,ONLY_FULL_GROUP_BY,STRICT_ALL_TABLES,STRICT_TRANS_TABLES';
 
DELIMITER ||
 
DROP PROCEDURE IF EXISTS `test`.`handle_error`;
CREATE PROCEDURE `test`.`handle_error`()
BEGIN
	RESIGNAL SET MESSAGE_TEXT = 'RESIGNALed';
END;
 
DROP PROCEDURE IF EXISTS `test`.`t`;
CREATE PROCEDURE `test`.`t`()
BEGIN
	DECLARE CONTINUE HANDLER
		FOR SQLWARNING
	BEGIN
		CALL `test`.`handle_error`();
	END;
	
	SELECT 1/0;
END;
 
||
DELIMITER ;

Let's try it:

MariaDB [(none)]> CALL test.t();
+------+
| 1/0  |
+------+
| NULL |
+------+
1 row in set (0.03 sec)
 
ERROR 1645 (0K000): RESIGNAL when handler not active
MariaDB [(none)]>

(I'm reporting this to MariaDB because Oracle registration requires too many personal data)



 Comments   
Comment by Elena Stepanova [ 2013-08-20 ]

Hi Federico,

If I understand correctly, it's documented as an intentional change between 5.5 and 5.6.
See this:
http://dev.mysql.com/doc/refman/5.6/en/resignal.html#resignal-handler
(the part "more difficult example)
and compare with
http://dev.mysql.com/doc/refman/5.5/en/resignal.html#resignal-handler

Could you please take a look and confirm (or not confirm) that it's the same case?

Comment by Federico Razzoli [ 2013-08-20 ]

Ouch! That's a bad change for me.
But yes, that example is exactly what I was talking about. Probably I didn't read it in the 5.6 docs - sorry for wasting your time.

Comment by Elena Stepanova [ 2013-08-20 ]

No problem, it was enlightening to find out.

Generated at Thu Feb 08 07:00:16 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.