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

Crash when using nested EXISTS

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Critical
    • Resolution: Duplicate
    • Affects Version/s: 10.4.6, 10.4.12
    • Fix Version/s: N/A
    • Component/s: Optimizer
    • Labels:
      None
    • Environment:
      Docker

      Description

      The following schema and (arguably bad) query results in a hard crash when tested against the latest (10.4.12) Docker image.

      CREATE TABLE storage_storagemedium (id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(id));
      CREATE TABLE storage_storageobject (id INT NOT NULL AUTO_INCREMENT, ip_id INT, PRIMARY KEY(id));
      CREATE TABLE storage_storagemethodtargetrelation (id INT NOT NULL AUTO_INCREMENT, storage_method_id INT, PRIMARY KEY(id));
      

      SELECT
          W0.`id`
      FROM
          `storage_storagemedium` W0
      WHERE (
          EXISTS(
              SELECT
                  V0.`id`
              FROM
                  `storage_storageobject` V0
              WHERE (
                  EXISTS(
                      SELECT
                          U0.`id`
                      FROM
                          `storage_storageobject` U0
                          INNER JOIN `storage_storagemethodtargetrelation` U4 ON (U0.`id` = U4.`storage_target_id`)
                      WHERE (
                              U0.`ip_id` = V0.`ip_id`
                              AND U4.`storage_method_id` = (
                                  SELECT
                                      U5.`storage_method_id`
                                  FROM
                                      `storage_storagemethodtargetrelation` U5
                                  WHERE
                                      U5.`storage_target_id` = V0.`id`
                                  LIMIT
                                      1
                              )
                      )
                  )
              )
          )
      )
      

      Feel free to rename this issue since I can't really pinpoint what part of the query exactly that is causing the crash yet.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              oskar Oskar Persson
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: