• Sergei Petrunia's avatar
    MDEV-13352: Server crashes in st_join_table::remove_duplicates · 9b4dfdaa
    Sergei Petrunia authored
    join_tab->distinct=true means "Before doing record read with this
    join_tab, call join_tab->remove_duplicates() to eliminate duplicates".
    remove_duplicates() assumes that
    - there is a temporary table $T with rows that are to be de-duplicated
    - there is a previous join_tab (e.g. with join_tab->fields) which was
    used to populate the temp.table $T.
    
    When the query has "Impossible WHERE" and window function, then the above
    conditions are not met (but we still might need a window function
    computation step when the query has implicit grouping).
    
    The fix is to not add remove_duplicates step if the select execution is
    degenerate (and we'll have at most one row in the output anyway).
    9b4dfdaa
win.result 67.4 KB