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

MIN/MAX and "HAVING func(DISTINCT)": wrong results

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 10.0.13
    • Fix Version/s: 10.0
    • Component/s: None
    • Labels:
      None

      Description

      I know that this bug has been fixed by Oracle:
      http://bugs.mysql.com/bug.php?id=69833

      But their solution (as it is documented in the bug page) is funny. I'm opening this to ask you if you could please apply a better fix.

      While the test case looks exotic, I realized that this causes bugs in an application when I use something like this:

      SELECT col1, MIN(col2), MAX(col2)
      FROM table
      GROUP BY col1
      HAVING COUNT(DISTINCT col1) > 1;

      Both MIN and MAX give completely wrong results, which makes the report useless. The only workaround I was able to find is slow.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

              Hide
              psergey Sergei Petrunia added a comment -

              ( Checked the source code: we have Mithun's fix, merged).

              Show
              psergey Sergei Petrunia added a comment - ( Checked the source code: we have Mithun's fix, merged).

                People

                • Assignee:
                  psergey Sergei Petrunia
                  Reporter:
                  f_razzoli Federico Razzoli
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  3 Start watching this issue

                  Dates

                  • Created:
                    Updated: