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

Wrong results in intersect all in Oracle Mode under view

    XMLWordPrintable

Details

    • Unexpected results
    • under a view, intersect all can generate different results (very rough draft)

    Description

      The test added in MDEV-25158 shows incorrect results under the view protocol:

      MariaDB [test]> create table t1 (a int, b int);
      Query OK, 0 rows affected (0.004 sec)
       
      MariaDB [test]> create table t2 like t1;
      Query OK, 0 rows affected (0.003 sec)
       
      MariaDB [test]> insert t1 values (1, 2), (1, 2), (1, 2), (2, 3), (2, 3), (3, 4), (3, 4);
      Query OK, 7 rows affected (0.003 sec)
      Records: 7  Duplicates: 0  Warnings: 0
       
      MariaDB [test]> insert t2 values (1, 2), (1, 2), (2, 3), (2, 3), (2, 3), (2, 3), (4, 5);
      Query OK, 7 rows affected (0.002 sec)
      Records: 7  Duplicates: 0  Warnings: 0
       
      MariaDB [test]> set sql_mode= 'oracle';
      Query OK, 0 rows affected (0.001 sec)
       
      MariaDB [test]> select * from t1 intersect all select * from t2 union values (1, 2);
      +------+------+
      | a    | b    |
      +------+------+
      |    1 |    2 |
      |    2 |    3 |
      |    1 |    2 |
      |    2 |    3 |
      +------+------+
      4 rows in set (0.002 sec)
       
      MariaDB [test]> create view t as select * from t1 intersect all select * from t2 union values (1, 2);
      Query OK, 0 rows affected (0.002 sec)
       
      MariaDB [test]> select * from t;
      +------+------+
      | a    | b    |
      +------+------+
      |    1 |    2 |
      |    2 |    3 |
      +------+------+
      2 rows in set (0.003 sec)
      

      main.intersect_all (11.4) extract)

      select * from t1 intersect all select * from t2 union values (1, 2);
      CURRENT_TEST: main.intersect_all
      --- /home/buildbot/x86-debian-12-fulltest/build/mysql-test/main/intersect_all.result	2025-07-09 04:06:09.000000000 +0000
      +++ /home/buildbot/x86-debian-12-fulltest/build/mysql-test/main/intersect_all.reject	2025-07-09 05:13:47.049907355 +0000
      @@ -1155,8 +1155,6 @@
       a	b
       1	2
       2	3
      -1	2
      -2	3
      

      https://buildbot.mariadb.org/#/builders/639/builds/13176/steps/32/logs/stdio

      Attachments

        Issue Links

          Activity

            People

              midenok Aleksey Midenkov
              danblack Daniel Black
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

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