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

Wrong result (missing row) on a 2nd execution of PS with exists_to_in=on, MERGE view or a SELECT SQ

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.0.6
    • 10.0.11
    • None
    • None

    Description

      Test case:

      SET optimizer_switch='exists_to_in=on';
       
      CREATE TABLE t1 (a INT) ENGINE=MyISAM;
      INSERT INTO t1 VALUES (1),(2);
       
      CREATE ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t1;
       
      CREATE TABLE t2 (b INT) ENGINE=MyISAM;
      INSERT INTO t2 VALUES (2),(3);
       
      SELECT * FROM v1 WHERE EXISTS ( SELECT * FROM t2 t2x, t2 t2y WHERE t2y.b = a );
       
      PREPARE stmt FROM "SELECT * FROM v1 WHERE EXISTS ( SELECT * FROM t2 t2x, t2 t2y WHERE t2y.b = a )";
      EXECUTE stmt;
      EXECUTE stmt;

      Results:

      MariaDB [test]> SELECT * FROM v1 WHERE EXISTS ( SELECT * FROM t2 t2x, t2 t2y WHERE t2y.b = a );
      +------+
      | a    |
      +------+
      |    2 |
      +------+
      1 row in set (0.01 sec)
       
      MariaDB [test]> PREPARE stmt FROM "SELECT * FROM v1 WHERE EXISTS ( SELECT * FROM t2 t2x, t2 t2y WHERE t2y.b = a );";
      Query OK, 0 rows affected (0.00 sec)
      Statement prepared
       
      MariaDB [test]> EXECUTE stmt;
      +------+
      | a    |
      +------+
      |    2 |
      +------+
      1 row in set (0.00 sec)
       
      MariaDB [test]> EXECUTE stmt;
      Empty set (0.00 sec)

      Also reproducible with a subquery instead of the view.

      Attachments

        Activity

          elenst Elena Stepanova created issue -
          elenst Elena Stepanova made changes -
          Field Original Value New Value
          serg Sergei Golubchik made changes -
          Fix Version/s 10.0.9 [ 14400 ]
          Fix Version/s 10.0.8 [ 14200 ]
          serg Sergei Golubchik made changes -
          Fix Version/s 10.0.10 [ 14500 ]
          Fix Version/s 10.0.9 [ 14400 ]
          sanja Oleksandr Byelkin made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          sanja Oleksandr Byelkin made changes -
          Status In Progress [ 3 ] Stalled [ 10000 ]
          sanja Oleksandr Byelkin made changes -
          Status Stalled [ 10000 ] In Progress [ 3 ]
          sanja Oleksandr Byelkin made changes -
          Status In Progress [ 3 ] Stalled [ 10000 ]
          ratzpo Rasmus Johansson (Inactive) made changes -
          Fix Version/s 10.0.11 [ 15200 ]
          Fix Version/s 10.0.10 [ 14500 ]
          sanja Oleksandr Byelkin made changes -
          Resolution Fixed [ 1 ]
          Status Stalled [ 10000 ] Closed [ 6 ]
          serg Sergei Golubchik made changes -
          Workflow defaullt [ 30634 ] MariaDB v2 [ 43689 ]
          ratzpo Rasmus Johansson (Inactive) made changes -
          Workflow MariaDB v2 [ 43689 ] MariaDB v3 [ 62845 ]
          serg Sergei Golubchik made changes -
          Workflow MariaDB v3 [ 62845 ] MariaDB v4 [ 147310 ]

          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.