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

Crash after reporting an error when using mutually recursive CTE

    XMLWordPrintable

Details

    Description

      The following test case:

      create table value_nodes (v char(4));
      create table module_nodes(m char(4));
      create table module_arguments(m char(4), v char(4));
      create table module_results(m char(4), v char(4));
       
      with recursive
      reached_values as 
      (
        select v from value_nodes where v in ('v3','v7','v9')
        union
        select module_results.v from module_results, applied_modules
           where module_results.m = applied_modules.m
      ),
      applied_modules as
      (
        select module_nodes.m
        from
          module_nodes
          left join
          ( 
            module_arguments
            left join
            reached_values
            on module_arguments.v = reached_values.v
           )
           on reached_values.v is null and
           module_nodes.m = module_arguments.m
        where module_arguments.m is null
      )
      select * from reached_values;
      

      causes a crash of the server after reporting the error:

      ERROR 4008 (HY000): Restrictions imposed on recursive definitions are violated for table 'applied_modules'.
      

      This can be seen in debugger.
      The debugger reports:

      Thread 33 "mysqld" received signal SIGSEGV, Segmentation fault.
      [Switching to Thread 0x7ffff426c300 (LWP 15272)]
      0x00000000006ca3f0 in mysql_derived_prepare (thd=0x7fff80000b00, lex=0x7fff80004518, derived=0x7fff80013698) at /home/igor/maria-git/10.2/sql/sql_derived.cc:794
      

      Attachments

        Activity

          People

            igor Igor Babaev
            igor Igor Babaev
            Votes:
            0 Vote for this issue
            Watchers:
            1 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.