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

Different result while executing a query directly and via a view

    XMLWordPrintable

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

            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.