• Igor Babaev's avatar
    MDEV-19919 Assertion `!prebuilt->index->is_primary()' failed · f9528821
    Igor Babaev authored
               in row_search_idx_cond_check
    
    For a single table query with ORDER BY and several sargable range
    conditions the optimizer may choose an execution plan that employs
    a rowid filter. In this case it is important to build the filter before
    calling the function JOIN_TAB::sort_table() that creates sort index
    for the result set, because when this is index created the filter has
    to be already filled. After the sort index has been created the
    filter must be deactivated. If not to do this the innodb function
    row_search_idx_cond_check() is getting confused when it has to read rows
    from the created sort index by using ha_rnd_pos().
    The order of actions mentioned above is needed also when processing a
    join query if sorting is performed for the first non constant table in
    the chosen execution plan.
    f9528821
sql_select.cc 927 KB