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

SIGABRT / assertion failure in st_select_lex_unit::optimize() at sql_union.cc:1124 when executing IN (SELECT ... INTERSECT SELECT ...)

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Incomplete
    • 10.2.5
    • N/A
    • None
    • None

    Description

      Summary

      MariaDB debug build crashes with SIGABRT in st_select_lex_unit::optimize() at
      sql_union.cc:1124 while executing queries that use INTERSECT (and similarly EXCEPT) inside IN
      / EXISTS subqueries.

      The assertion is:

      DBUG_ASSERT(0);

      This is reached when ha_enable_indexes(HA_KEY_SWITCH_ALL) returns non-zero during UNION
      DISTINCT/INTERSECT subquery optimization.

      Environment

      • Version: 10.2.5-MariaDB-debug
      • Platform: Linux
      • Port: 3307
      • Build: debug build from local source tree

      Assertion

      mysqld: /data/mariadb/sql/sql_union.cc:1124:
      bool st_select_lex_unit::optimize(): Assertion `0' failed.

      Source location:

      if (union_distinct && table->file->ha_enable_indexes(HA_KEY_SWITCH_ALL))

      { DBUG_ASSERT(0); }

      Minimal Reproducer

      CREATE TABLE test.t_in_intersect_test (
      id INT PRIMARY KEY AUTO_INCREMENT,
      value INT
      );

      INSERT INTO test.t_in_intersect_test(value) VALUES (1),(2),(3),(4),(5);

      SELECT /*+ IN_SUBQUERY_INTERSECT_NOMATCH */ id, value
      FROM test.t_in_intersect_test
      WHERE value IN (SELECT 1 INTERSECT SELECT 2);

      Expected Result

      The query should return an empty result set.

      Actual Result

      The server aborts with SIGABRT and crashes.

      Attachments

        Activity

          People

            Unassigned Unassigned
            chunlingqin chunlingqin
            Votes:
            0 Vote for this issue
            Watchers:
            3 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.