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

Cursor protocol gives wrong result with aggregate function and optimizer hints "straight_join" when there is no resultset

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.4, 10.5, 10.6, 10.9, 10.10, 11.0, 11.1, 11.2
    • 10.4, 10.5, 10.6, 11.1, 11.2
    • None
    • None

    Description

      Testcase:

      create table t1
      (
      	PARENT_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
      	PARENT_FIELD VARCHAR(10),
      	PRIMARY KEY (PARENT_ID)
      );
       
      create table t2
      (
      	CHILD_ID INT NOT NULL AUTO_INCREMENT,
      	PARENT_ID INT NOT NULL,
      	CHILD_FIELD varchar(10),
      	PRIMARY KEY (CHILD_ID)
      );
       
      INSERT INTO t1 (PARENT_FIELD)
      SELECT 'AAAA';
       
      INSERT INTO t2 (PARENT_ID, CHILD_FIELD)
      SELECT 1, 'BBBB';
       
      select
       t1.PARENT_ID,
       min(CHILD_FIELD)
       from t1 straight_join t2
       where t1.PARENT_ID = 1
       and t1.PARENT_ID = t2.PARENT_ID
       and t2.CHILD_FIELD = "ZZZZ";
       
      DROP TABLES t1, t2;
      

      Expected result:

      PARENT_ID	min(CHILD_FIELD)
      NULL	NULL
      

      Actual result:

      PARENT_ID	min(CHILD_FIELD)
      0	NULL
      

      Attachments

        Issue Links

          Activity

            People

              sanja Oleksandr Byelkin
              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.