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

Different result while executing a query directly and via a view

Details

    Description

      CREATE TABLE t1 (a INT, b INT);
      INSERT INTO t1 VALUES (2,20),(3,30);
      CREATE TABLE t2 (c INT);
      INSERT INTO t2 VALUES (1),(10),(100);
       
      SELECT a FROM t1 WHERE a IN ( b <= ALL ( SELECT c FROM t2 ) );
       
      CREATE VIEW v AS
      SELECT a FROM t1 WHERE a IN ( b <= ALL ( SELECT c FROM t2 ) );
      SELECT * FROM v;
       
      DROP VIEW v;
      DROP TABLE t1, t2;
      

      Plain query

      MariaDB [test]> SELECT a FROM t1 WHERE a IN ( b <= ALL ( SELECT c FROM t2 ) );
      Empty set (0.00 sec)
      

      View

      MariaDB [test]> CREATE VIEW v AS
          -> SELECT a FROM t1 WHERE a IN ( b <= ALL ( SELECT c FROM t2 ) );
      Query OK, 0 rows affected (0.08 sec)
       
      MariaDB [test]> SELECT * FROM v;
      +------+
      | a    |
      +------+
      |    2 |
      |    3 |
      +------+
      2 rows in set (0.00 sec)
      

      Also reproducible with MySQL 5.5, 5.7. I didn't file a bug for MySQL, though.

      Attachments

        Issue Links

          Activity

            elenst Elena Stepanova created issue -
            sanja Oleksandr Byelkin made changes -
            Field Original Value New Value
            Status Open [ 1 ] In Progress [ 3 ]
            sanja Oleksandr Byelkin made changes -
            Status In Progress [ 3 ] Stalled [ 10000 ]
            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 81922 ] MariaDB v4 [ 143517 ]
            alice Alice Sherepa made changes -
            alice Alice Sherepa made changes -
            Fix Version/s N/A [ 14700 ]
            Fix Version/s 10.2 [ 14601 ]
            Resolution Duplicate [ 3 ]
            Status Stalled [ 10000 ] Closed [ 6 ]

            People

              sanja Oleksandr Byelkin
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

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