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

LP:823169 - Diverging results with GROUP BY + NULL in ANY subquery

    XMLWordPrintable

Details

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

    Description

      The following 2 queries:

      SELECT a FROM t1 WHERE b < ANY ( SELECT b FROM t1 GROUP BY b );
      SELECT a FROM t1 WHERE b < ANY ( SELECT b FROM t1 );

      are equivalent and yet they return identical results. The first query returns no rows, the second returns rows.

      Test case:

      CREATE TABLE t1 (a int(11), b varchar(1));
      INSERT INTO t1 VALUES (NULL,'x'),(8,'d'),(1,'r'),(9,'f'),(4,'y'),(3,'u'),(2,'m'),(NULL,NULL),(2,'o'),(NULL,'w'),(6,'m'),(7,'q'),(2,NULL),(5,'d'),(7,'g'),(6,'x'),(6,'f'),(2,'p'),(9,'j'),(6,'c');

      SELECT a FROM t1 WHERE b < ANY ( SELECT b FROM t1 GROUP BY b );
      SELECT a FROM t1 WHERE b < ANY ( SELECT b FROM t1 );

      Repeatable in maria-5.3,maria-5.2, mysql-5.5

      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.