Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Not a Bug
-
10.0.4
-
None
-
None
-
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)