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

SQL_ERROR_LOG plugin doesn't log errors produced with SIGNAL

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.0.3
    • Fix Version/s: 10.0.8
    • Component/s: None
    • Labels:
      None

      Description

      Since SQL_ERROR_LOG logs all errors that happen withing a stored procedure (while only the last one is returned to the user), it can be a useful debug tool. Thus I've tried to use SIGNAL to add debug messages to my procedures during development, but it seems that the SIGNALed errors are not logged:

      DELIMITER ||
      DROP PROCEDURE IF EXISTS t;
      CREATE PROCEDURE t()
      BEGIN
      	DECLARE n TINYINT UNSIGNED DEFAULT rand();
      	DECLARE CONTINUE HANDLER
      		FOR SQLSTATE '01000'
      		DO NULL;
      	IF n <= 1 THEN
      		SET @dbug_msg = CONCAT('n=', n);
      		SIGNAL SQLSTATE '01000' SET
      			MYSQL_ERRNO = 1644,
      			MESSAGE_TEXT = @dbug_msg;
      	ELSE
      		SIGNAL SQLSTATE '01000' SET
      			MYSQL_ERRNO = 1644,
      			MESSAGE_TEXT = 'Hey... how did this happen??';
      	END IF;
      	DO 'something';
      END;
      ||
      DELIMITER ;
      CALL t();

      If you replace SIGNAL with SELECT 1 FROM not_existing_table, the error is logged (DECLARE HANDLER doesn't interfer with SQL_ERRORS_LOG, and this is good).

      I used '01000' SQL STATE and 1644 code because they are not warnings.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              holyfoot Alexey Botchkov
              Reporter:
              f_razzoli Federico Razzoli
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Due:
                Created:
                Updated:
                Resolved:

                  Git Integration

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