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

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

    XMLWordPrintable

Details

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

    Description

      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

      ---------------+

      Attachments

        Activity

          People

            timour Timour Katchaounov (Inactive)
            timour Timour Katchaounov (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.