• Igor Babaev's avatar
    MDEV-19580 Unrelated JOINs corrupt usage of 'WHERE function() IN (subquery)' · 6db2ebbb
    Igor Babaev authored
    Handling of top level conjuncts in WHERE whose used_tables() contained
    RAND_TABLE_BIT in the function make_join_select() was incorrect.
    As a result if such a conjunct referred to fields non of which belonged
    to the last joined table  it was pushed twice. (This could be seen
    for a test case from subselect.test whose output was changed after this
    patch had been applied. In 10.1 when running EXPLAIN FORMAT=JSON for
    the query from this test case we clearly see that one of the conjuncts
    is pushed twice.) This fact by itself was not good. Besides, if such a
    conjunct was pushed to a table that was the result of materialization
    of a semi-join the query could return a wrong result set. In particular
    we could watch it for queries with semi-join subqueries whose left parts
    used stored functions without "deterministic' specifier.
    6db2ebbb
subselect_sj_mat.test 75 KB