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

lp:985667 Wrong result with subquery in SELECT clause, and constant table in main query and implicit grouping

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.5.23, 5.3.6
    • Fix Version/s: 5.5.24, 5.3.7
    • Component/s: None
    • Labels:
      None

      Description

      https://bugs.launchpad.net/maria/+bug/985667

      The following test case, extracted from the test for bug lp:680846 produces wrong result:

      CREATE TABLE t1 (f1 int) ;
      INSERT INTO t1 VALUES (7),(8);
      
      CREATE TABLE t2 (f2 int, f3 varchar(32)) ;
      INSERT INTO t2 VALUES (1,'f');
      
      SELECT COUNT(f2), (SELECT f1 FROM t1 WHERE t2.f2 limit 1) AS f4
      FROM t2, t1
      WHERE 'v'= t2.f3;
      
      +-----------+------+
      | COUNT(f2) | f4   |
      +-----------+------+
      |         0 |    7 |
      +-----------+------+
      

      The correct result is:

      +-----------+------+
      | COUNT(f2) | f4   |
      +-----------+------+
      |         0 | NULL |
      +-----------+------+
      

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            timour Timour Katchaounov added a comment -

            Pushed to MariaDB 5.3

            Show
            timour Timour Katchaounov added a comment - Pushed to MariaDB 5.3

              People

              • Assignee:
                timour Timour Katchaounov
                Reporter:
                sanja Oleksandr Byelkin
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 4 days
                  4d