• Igor Babaev's avatar
    Fixed the bug mdev-12556. · c7a15345
    Igor Babaev authored
    When the rows produced on the current iteration are sent to the
    temporary table T of the UNION type created for CTE the rows
    that were not there simultaneously are sent to the temporary
    table D that contains rows for the next iteration. The test
    whether a row was in T checks the return code of writing into T.
    If just a HEAP table is used for T then the return code is
    HA_ERR_FOUND_DUPP_KEY, but if an ARIA table is used for T then
    the return code is HA_ERR_FOUND_DUPP_UNIQUE.
    The implementation of select_union_recursive::send_data()
    erroneously checked only for the first return code. So if an Aria
    table was used for T then all rows produced by the current iteration
    went to D and and in most cases D grew with each iteration.
    Whether T has reached stabilization is detected by
    checking whether D is empty. So as a result, the iterations were
    never stopped unless a limit for them was set.
    
    Fixed by checking for both HA_ERR_FOUND_DUPP_KEY and
    HA_ERR_FOUND_DUPP_UNIQUE as return codes returned by
    the function writing a row into the temporary table T.
    c7a15345
cte_recursive.result 69.6 KB