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

REPEAT statement_list has one more iteration

    XMLWordPrintable

    Details

      Description

      Based on comment of a question in KB open question.
      There is different result in 10.2 and 10.3 for REPEAT
      stated here:

      DELETE FROM t1;
       
      DELIMITER //
       
      CREATE PROCEDURE dorepeat(p1 INT)
        BEGIN
          SET @x = 0;
          REPEAT 
            SET @x = @x + 1; 
            INSERT INTO t1 VALUES ("");
          UNTIL @x >= p1 
          END REPEAT;
        END
      //
       
      CALL dorepeat(100)//
       
      SELECT @x//
      DELIMITER ;
      SELECT * FROM t1;
      DROP TABLE t1;
      

      In 10.2 we are obtaining like so:

      MariaDB [test]> SELECT @x//
      +------+
      | @x   |
      +------+
      |  100 |
      +------+
      1 row in set (0.001 sec)
      

      and in 10.3 we are obtaining bug (one more iteration), like so:

      MariaDB [test]> SELECT @x//
      +------+
      | @x   |
      +------+
      |  101 |
      +------+
      1 row in set (0.000 sec)
      
      

        Attachments

          Activity

            People

            Assignee:
            anel Anel Husakovic
            Reporter:
            anel Anel Husakovic
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: