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

LP:938518 - HAVING does not reject the result of aggregation

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • None
    • None
    • None

    Description

      Using mariadb-5.2 create and populate table 1 with the following commands:

      CREATE TABLE t1 (pk INT PRIMARY KEY, a INT);
      INSERT INTO t1 VALUES (2,7), (4,7), (6,2), (17,0);

      Execute the following queries:
      SELECT MIN(t.pk) FROM t1, t1 as t WHERE t1.pk = 1;
      SELECT MIN(t.pk) FROM t1, t1 as t WHERE t1.pk = 1 HAVING MIN(t.pk) < 10;

      The first query return the right result while the second query returns a wrong result:

      MariaDB [test]> SELECT MIN(t.pk) FROM t1, t1 as t WHERE t1.pk = 1;
      -----------

      MIN(t.pk)

      -----------

      NULL

      -----------

      MariaDB [test]> SELECT MIN(t.pk) FROM t1, t1 as t WHERE t1.pk = 1 HAVING MIN(t.pk) < 10;
      -----------

      MIN(t.pk)

      -----------

      NULL

      -----------

      Attachments

        Activity

          People

            sanja Oleksandr Byelkin
            igor Igor Babaev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 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.