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

HAVING clause yields wrong results in 10.2 and 10.3, fine in 10.1

    XMLWordPrintable

Details

    • Bug
    • Status: In Review (View Workflow)
    • Critical
    • Resolution: Unresolved
    • 10.5, 10.6, 10.2.26, 10.3.12, 10.2(EOL), 10.3(EOL), 10.4(EOL), 10.7(EOL), 10.8(EOL), 10.9(EOL), 10.10(EOL)
    • 10.5, 10.6
    • Optimizer

    Description

      As you can see in the attached test case a query behaves differently in 10.1 vs 10.2 and 10.3

      10.1

      select distinct concat(table1.T1_VAL,table1.T1_VAR) as CC, concat(table1.T1_VAL,table1.T1_VAR) = 'VALB' as chk, group_concat(table2.T3_ID) as id from test.table1 LEFT JOIN (test.table2,test.table3) on concat(T1_VAL,T1_VAR) = table2.T2_VALVAR and table2.T3_ID = table3.T3_ID group by T1_ID having CC = 'VALB';
      +------+-----+------+
      | CC   | chk | id   |
      +------+-----+------+
      | VALB |   1 | 1    |
      +------+-----+------+
      1 row in set (0.00 sec)
      

      10.2 & 10.3

      select distinct concat(table1.T1_VAL,table1.T1_VAR) as CC, concat(table1.T1_VAL,table1.T1_VAR) = 'VALB' as chk, group_concat(table2.T3_ID) as id from test.table1 LEFT JOIN (test.table2,test.table3) on concat(T1_VAL,T1_VAR) = table2.T2_VALVAR and table2.T3_ID = table3.T3_ID group by T1_ID having CC = 'VALB';
      Empty set (0.01 sec)
      
      

      – No Results –

      Attachments

        Activity

          People

            psergei Sergei Petrunia
            claudio.nanni Claudio Nanni
            Votes:
            2 Vote for this issue
            Watchers:
            12 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.