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

Issues with Subquery Independence

    XMLWordPrintable

Details

    • Bug
    • Status: Needs Feedback (View Workflow)
    • Critical
    • Resolution: Unresolved
    • 11.5.2
    • None
    • Optimizer
    • None

    Description

      The exported file for the database is in the attachment.

      --orignal sql
      SELECT L_SHIPINSTRUCT, L_EXTENDEDPRICE, L_COMMENT
      FROM LINEITEM
      WHERE L_SHIPMODE NOT IN (
          SELECT L_COMMITDATE
          FROM LINEITEM
      );
      

      return 0 row

      --rewritten sql
      SELECT L_SHIPINSTRUCT, L_EXTENDEDPRICE, L_COMMENT
      FROM LINEITEM
      WHERE L_SHIPMODE NOT IN (
          SELECT L_COMMITDATE
          FROM LINEITEM
          WHERE L_COMMITDATE IS NOT NULL
      );
      

      return 5905 rows

      The two queries are identical, although the rewritten query includes an additional WHERE L_COMMITDATE IS NOT NULL condition in the subquery. Since NULL values are implicitly excluded in the original query, this condition does not have a substantial impact on the final result. However, the different row counts indicate that a bug is present.

      Attachments

        Activity

          People

            Unassigned Unassigned
            luopeiqi luopeiqi
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.