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

NULL is treated as 0 in CTE

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 10.2
    • Fix Version/s: 10.2
    • Component/s: Optimizer - CTE
    • Labels:
      None

      Description

      Current 10.2 and 10.3 behave different on NULL

      10.3

      MariaDB [test]> select version();
      +----------------------+
      | version()            |
      +----------------------+
      | 10.3.8-MariaDB-debug |
      +----------------------+
      1 row in set (0.000 sec)
       
      MariaDB [test]> WITH RECURSIVE qn AS (SELECT 123 AS a UNION ALL
          -> SELECT NULL FROM qn WHERE a IS NOT NULL) SELECT * FROM qn;
      +------+
      | a    |
      +------+
      |  123 |
      | NULL |
      +------+
      2 rows in set (0.002 sec)
      

      10.2 is producing 123, 0,0,0,0,...

      MariaDB [test]> WITH RECURSIVE qn AS (SELECT 123 AS a UNION ALL
          -> SELECT NULL FROM qn WHERE a IS NOT NULL) SELECT * FROM qn;
      ^CCtrl-C -- query killed. Continuing normally.
      ERROR 1317 (70100): Query execution was interrupted
       
      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:
              1 Start watching this issue

                Dates

                Created:
                Updated: