• Rex's avatar
    MDEV-31983 jointable materialization subquery optimization ignoring · ec2574fd
    Rex authored
    ...errors, then failing ASSERT.
    
    UPDATE queries treat warnings as errors. In this case, an invalid
    condition "datetime_key_col >= '2012-01'" caused warning-as-error inside
    SQL_SELECT::test_quick_select().
    
    The code that called test_quick_select() ignored this error and continued
    join optimization. Then it eventually reached a thd->is_error() check
    and failed to setup SJ-Materialization which failed an assert.
    
    Fixed this by making SQL_SELECT::test_quick_select() return error in
    its return value, and making any code that calls it to check for error
    condition and abort the query if the error is returned.
    
    Places in the code that didn't check for errors from
    SQL_SELECT::test_quick_select but now do:
    - get_quick_record_count() call in make_join_statistics(),
    - test_if_skip_sort_order(),
    - "Range checked for each record" code.
    
    Extra error handling fixes and commit text wording by Sergei Petrunia,
    
    Reviewed-by: Sergei Petrunia, Oleg Smirnov
    ec2574fd
subselect_sj_mat.test 78.6 KB