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

Wrong result on 2nd execution for PS with NULL on MAX function and IN predicate

    XMLWordPrintable

Details

    Description

      Testcase:

      CREATE TABLE t1 (a INT) ENGINE=MyISAM;
      CREATE TABLE t2 (b INT) ENGINE=MyISAM;
      INSERT INTO t2 VALUES (1);
       
      prepare stmt1 from "SELECT MAX(a), a in ( SELECT b FROM t2 ) AS bb FROM t1";
       
      execute stmt1;
      execute stmt1;
       
      prepare stmt2 from "SELECT MAX(a), a >= ALL ( SELECT b FROM t2 ) AS bb FROM t1";
      execute stmt2;
      execute stmt2;
       
      deallocate prepare stmt1;
      deallocate prepare stmt2;
      drop table t1, t2;
      

      Actual result:

      prepare stmt1 from "SELECT MAX(a), a in ( SELECT b FROM t2 ) AS bb FROM t1";
      execute stmt1;
      MAX(a)	bb
      NULL	NULL
      execute stmt1;
      MAX(a)	bb
      NULL	0
      prepare stmt2 from "SELECT MAX(a), a >= ALL ( SELECT b FROM t2 ) AS bb FROM t1";
      execute stmt2;
      MAX(a)	bb
      NULL	NULL
      execute stmt2;
      MAX(a)	bb
      NULL	1
      

      Expected result:

      prepare stmt1 from "SELECT MAX(a), a in ( SELECT b FROM t2 ) AS bb FROM t1";
      execute stmt1;
      MAX(a)	bb
      NULL	NULL
      execute stmt1;
      MAX(a)	bb
      NULL	NULL
      prepare stmt2 from "SELECT MAX(a), a >= ALL ( SELECT b FROM t2 ) AS bb FROM t1";
      execute stmt2;
      MAX(a)	bb
      NULL	NULL
      execute stmt2;
      MAX(a)	bb
      NULL	NULL
      

      Attachments

        Issue Links

          Activity

            People

              shulga Dmitry Shulga
              lstartseva Lena Startseva
              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.