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

LP:813418 - Wrong result with aggregate + NOT BETWEEN + key

    XMLWordPrintable

Details

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

    Description

      Repeatable in mysql-5.1,5.5, maria 5.1, 5.2, 5.5. The following query:

      SELECT MAX(a) FROM t1 WHERE a NOT BETWEEN 3 AND 9;

      returns NULL even though there are obviously rows that match the WHERE predicate.

      explain:

      id select_type table type possible_keys key key_len ref rows Extra
      1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No matching min/max row

      test case:

      CREATE TABLE t1 (a int, KEY (a));
      INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
      SELECT MAX(a) FROM t1 WHERE a NOT BETWEEN 3 AND 9;

      Attachments

        Activity

          People

            sanja Oleksandr Byelkin
            philipstoev Philip Stoev (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.