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

Segfault on select query using index for group-by and filesort

    XMLWordPrintable

Details

    Description

      When I execute:

      SELECT T2.`Name` 
      FROM (
      	SELECT `Country` FROM `religion` GROUP BY `Country` ORDER BY COUNT(DISTINCT `Name`) DESC LIMIT 1 
      ) AS T1 
      INNER JOIN `country` AS T2
      ON T1.`Country`=T2.`Code`
      

      MariaDB crashes. The log is attached. A dump of the data is attached.

      Expected behaviour: The query returns country name with the highest count of distinct religions.

      Reproducibility: On macOS 12.6, case insensitive file system, with a fresh installation of MariaDB 10.7.3 from Homebrew I only get a misleading error message (the db remains responsive to other queries):

      2003 - Can't connect to MySQL server on '127.0.0.1' (61 "Connection refused")
      

      Severity: It causes a crash on a select query → marking as Critical.

      What I checked:

      1. I renamed `Country` column name to not clash with `country` table. It didn't have any impact.
      2. When I change `LIMIT 1` to `LIMIT 2`, the query works.

      Attachments

        1. log.txt
          5 kB
        2. Mondial.sql
          48 kB

        Issue Links

          Activity

            People

              oleg.smirnov Oleg Smirnov
              yzan Jan Motl
              Votes:
              1 Vote for this issue
              Watchers:
              8 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.