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

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 10.7
    • Fix Version/s: 10.7.1
    • Component/s: Server
    • Labels:
      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

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

                Dates

                Created:
                Updated:
                Resolved:

                  Git Integration