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

convert_subq_to_jtbm() contains unreachable code since optimization_delayed is always TRUE

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Minor
    • Resolution: Unresolved
    • 10.2(EOL), 10.3(EOL), 10.4(EOL), 10.5(EOL), 10.6, 10.7(EOL), 10.8(EOL)
    • 10.6, 10.11
    • None
    • None

    Description

      sql/opt_subselect.cc:2032
      Local variable optimization_delayed is set to TRUE in the beginning of the function, and never changed. So the code inside "if (optimization_delayed)" always returns, and we never execute the rest of the function.

      static bool convert_subq_to_jtbm(JOIN *parent_join, 
                                       Item_in_subselect *subq_pred, 
                                       bool *remove_item)
      {
        SELECT_LEX *parent_lex= parent_join->select_lex;
        List<TABLE_LIST> *emb_join_list= &parent_lex->top_join_list;
        TABLE_LIST *emb_tbl_nest= NULL; // will change when we learn to handle outer joins
        TABLE_LIST *tl;
        bool *optimization_delayed= TRUE;*
      ...
        if (optimization_delayed)
        {
          DBUG_ASSERT(parent_join->table_count < MAX_TABLES);
       
          jtbm->jtbm_table_no= parent_join->table_count;
       
          create_subquery_temptable_name(&tbl_alias,
                                         subq_pred->unit->first_select()->select_number);
          jtbm->alias.str=    tbl_alias.str;
          jtbm->alias.length= tbl_alias.length;
          parent_join->table_count++;
          *DBUG_RETURN(thd->is_fatal_error);*    <== Always return here
        }
      ...
      [code that is never executed]
      }
      

      Attachments

        Activity

          People

            psergei Sergei Petrunia
            yury.chaikou Yury Chaikou
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.