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

Unexpected ROW_NUMBER in a condition raised by a diagnostics statement

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Fixed
    • 10.7(EOL)
    • 10.7.1
    • Server
    • None

    Description

      It appears that when a diagnostics statement raises a condition, it inherits the counter value from the previous statement (regardless whether it had conditions of its own or not) and uses it for ERROR_INDEX.

      create table t1 (a int);
      insert into t1 values (1),(2);
      get diagnostics condition 5 @msg = message_text;
      show warnings;
      get diagnostics condition 1 @ind = error_index, @msg = message_text;
      select @ind, @msg;
       
      # Cleanup
      drop table t1;
      

      10.7 d552e092

      MariaDB [test]> get diagnostics condition 5 @msg = message_text;
      Query OK, 0 rows affected, 1 warning (0.000 sec)
       
      MariaDB [test]> show warnings;
      +-------+------+--------------------------+
      | Level | Code | Message                  |
      +-------+------+--------------------------+
      | Error | 1758 | Invalid condition number |
      +-------+------+--------------------------+
      1 row in set (0.000 sec)
       
      MariaDB [test]> get diagnostics condition 1 @ind = error_index, @msg = message_text;
      Query OK, 0 rows affected (0.000 sec)
       
      MariaDB [test]> select @ind, @msg;
      +------+--------------------------+
      | @ind | @msg                     |
      +------+--------------------------+
      |    3 | Invalid condition number |
      +------+--------------------------+
      1 row in set (0.000 sec)
      

      Attachments

        Issue Links

          Activity

            People

              rucha174 Rucha Deodhar
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

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