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

Output parameter is not assigned when rising SIGNAL (Class >= '02' (exception))

    XMLWordPrintable

Details

    Description

      MariaDB [test]> SELECT VERSION();
      +-------------------+
      | VERSION()         |
      +-------------------+
      | 10.1.12-MariaDB-1 |
      +-------------------+
      1 row in set (0.00 sec)
       
      MariaDB [test]> DROP PROCEDURE IF EXISTS `sp_bug`;
      Query OK, 0 rows affected, 1 warning (0.00 sec)
       
      MariaDB [test]> DELIMITER //
       
      MariaDB [test]> CREATE PROCEDURE `sp_bug`(OUT `out_parameter` INT UNSIGNED)
          -> BEGIN
          ->     DECLARE EXIT HANDLER FOR SQLEXCEPTION
          ->     BEGIN
          ->         SET `out_parameter` := 2;
          ->         SELECT `out_parameter`;        
          ->         RESIGNAL;
          ->     END;
          ->     SET `out_parameter` := 1;
          ->     SELECT `out_parameter`;
          ->     SIGNAL SQLSTATE '45000' SET
          ->         MYSQL_ERRNO = 2,
          ->         MESSAGE_TEXT = 'Too long';
          -> END//
      Query OK, 0 rows affected (0.00 sec)
       
      MariaDB [test]> DELIMITER ;
       
      MariaDB [test]> SET @`out_parameter` := NULL;
      Query OK, 0 rows affected (0.00 sec)
       
      MariaDB [test]> CALL `sp_bug`(@`out_parameter`);
      +-----------------+
      | `out_parameter` |
      +-----------------+
      |               1 |
      +-----------------+
      1 row in set (0.00 sec)
       
      +-----------------+
      | `out_parameter` |
      +-----------------+
      |               2 |
      +-----------------+
      1 row in set (0.00 sec)
       
      ERROR 2 (45000): Too long
       
      MariaDB [test]> SHOW WARNINGS;
      +-------+------+----------+
      | Level | Code | Message  |
      +-------+------+----------+
      | Error |    2 | Too long |
      +-------+------+----------+
      1 row in set (0.00 sec)
       
      MariaDB [test]> SELECT @`out_parameter`;
      +------------------+
      | @`out_parameter` |
      +------------------+
      | NULL             |
      +------------------+
      1 row in set (0.00 sec)
      

      Attachments

        Activity

          People

            serg Sergei Golubchik
            wchiquito William Chiquito
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.