• Sergei Petrunia's avatar
    MDEV-13352: Server crashes in st_join_table::remove_duplicates · 17fc288b
    Sergei Petrunia authored
    Do not run the window function computation step when the select
    produces no rows (zero_result_cause!=NULL).
    This may cause reads from uninitialized memory.
    
    We still need to run the window function computation step when
    the output includes just one row  (for example
    SELECT MAX(col), RANK() OVER (...) FROM t1 WHERE 1=0).
    
    This fix also resolves an issue with queries with window functions
    producing an output row where should be none, like in
    SELECT ROW_NUMBER() FROM t1 WHERE 1=0.
    
    Updated a few test results in the existing tests to reflect this.
    17fc288b
win.result 63.4 KB