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

SEGV Segmentation fault on querys thats include subquery with distinct, conditional and filters

    XMLWordPrintable

Details

    Description

      After updating from version 10.5.23 to version 10.5.26, we started experiencing SIGV errors when running some queries in our system that we had been using and that were previously working correctly.

      The error occurs in the latest version when executing queries that include subqueries with DISTINCT, selects with conditionals, and then, in the top-level query, filtering based on those fields. Below are the steps to replicate the error.

      CREATE TABLE `bug`.`test`  (
        `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
        `field` varchar(255) NULL DEFAULT NULL,
        PRIMARY KEY (`id`)
      );
       
      SELECT * 
      FROM (
      	SELECT DISTINCT
      		`test`.`id`,
      		CASE `field`
      			WHEN 'example' THEN '1'
      			ELSE '0'
      		END AS `bug`
      	FROM `test`
      ) AS `tmp`
      WHERE `bug` = '1';
      

      Mariadb client query result:
      ERROR 2013 (HY000): Lost connection to MySQL server during query

      Debian daemon log:

      systemd[1]: mariadb.service: Main process exited, code=killed, status=11/SEGV
      

      mariadbd result:
      Segmentation fault

      Log errors is clear.

      Some test:

      • It is not necessary for the table to have data.
      • Without DISTINCT query works.
      • Other fields, no conditionals, query works.
      • Filter over other fields, no conditionals, query works.
      • In previous version 10.5.23, query works.

      ¿Some ideas?

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              alegueva Alejandro Guevara
              Votes:
              0 Vote for this issue
              Watchers:
              4 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.