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

CTE with overflow of integer type returns wrong results

    XMLWordPrintable

    Details

      Description

      in 10.3:

      MariaDB [test]> WITH RECURSIVE qn AS (SELECT 1 AS a FROM dual UNION SELECT a*2000 FROM qn WHERE a<10000000000000000000) SELECT count(*) FROM qn;
      +----------+
      | count(*) |
      +----------+
      |        4 |
      +----------+
      1 row in set (0.002 sec)
       
      MariaDB [test]> select version();
      +----------------------+
      | version()            |
      +----------------------+
      | 10.3.8-MariaDB-debug |
      +----------------------+
      1 row in set (0.000 sec)
      

      Expected to return error, as in 10.2:

      MariaDB [test]> WITH RECURSIVE qn AS (SELECT 1 AS a FROM dual UNION SELECT a*2000 FROM qn WHERE a<10000000000000000000) SELECT count(*) FROM qn;
      ERROR 1690 (22003): BIGINT value is out of range in '`qn`.`a` * 2000'
       
      MariaDB [test]> select version();
      +-----------------------+
      | version()             |
      +-----------------------+
      | 10.2.16-MariaDB-debug |
      +-----------------------+
      1 row in set (0.00 sec)
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              igor Igor Babaev
              Reporter:
              alice Alice Sherepa
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated: