Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-4924

Error 1645: RESIGNAL when handler not active

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Not a Bug
    • Affects Version/s: 10.0.4
    • Fix Version/s: None
    • Component/s: None
    • 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)

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            elenst Elena Stepanova added a comment -

            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?

            Show
            elenst Elena Stepanova added a comment - 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?
            Hide
            f_razzoli Federico Razzoli added a comment -

            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.

            Show
            f_razzoli Federico Razzoli added a comment - 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.
            Hide
            elenst Elena Stepanova added a comment -

            No problem, it was enlightening to find out.

            Show
            elenst Elena Stepanova added a comment - No problem, it was enlightening to find out.

              People

              • Assignee:
                Unassigned
                Reporter:
                f_razzoli Federico Razzoli
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: