Uploaded image for project: 'MariaDB ColumnStore'
  1. MariaDB ColumnStore
  2. MCOL-424

cross engine subquery losing where clause causing incorrect results

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • None
    • 1.0.6
    • None
    • None
    • 2016-23

    Description

      Query:
      SELECT * FROM trans_test t WHERE t.`member_id` IN (SELECT id FROM member_test WHERE id =1)

      It is returning all rows from member_test

      In info.log on um1, I can see the following:
      CAL0000: QUERY to foreign engine: SELECT id FROM member_test

      It looks as if the where condition is being excluded

      SELECT * FROM trans_test t WHERE t.`member_id` IN (1) yields the correct result. I would expect the same result from the above query.

      Steps to repro:

      CREATE TABLE `trans_test` (
        `id` int(11) DEFAULT NULL,
        `member_id` int(11) DEFAULT NULL,
        `name` varchar(50) DEFAULT NULL
      ) ENGINE=Columnstore DEFAULT CHARSET=latin1;
       
      /*Data for the table `trans_test` */
       
      insert  into `trans_test`(`id`,`member_id`,`name`) values (1,1,'trans 1');
      insert  into `trans_test`(`id`,`member_id`,`name`) values (2,2,'trans 2');
      insert  into `trans_test`(`id`,`member_id`,`name`) values (3,1,'trans 3');
      insert  into `trans_test`(`id`,`member_id`,`name`) values (4,2,'trans 4');
      insert  into `trans_test`(`id`,`member_id`,`name`) values (5,1,'trans 5');
       
       
      CREATE TABLE `member_test` (
        `id` int(11) NOT NULL AUTO_INCREMENT,
        `name` varchar(50) NOT NULL,
        PRIMARY KEY (`id`)
      ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
       
      /*Data for the table `member_test` */
       
      insert  into `member_test`(`id`,`name`) values (1,'member 1');
      insert  into `member_test`(`id`,`name`) values (2,'member 2');
      insert  into `member_test`(`id`,`name`) values (3,'member 3');
       
      SELECT * FROM trans_test t WHERE t.`member_id` IN (SELECT id FROM member_test WHERE id =1);
      

      Attachments

        Issue Links

          Activity

            People

              dleeyh Daniel Lee (Inactive)
              dthompson David Thompson (Inactive)
              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.