MDEV-30975 Wrong result with cross Join given join order
For queries with derived tables populated having some side-effect, we will fill such a derived table more than once, but without clearing its rows. Consequently it will have duplicate rows. An example query exhibiting the problem is SELECT STRAIGHT_JOIN c1 FROM t1 JOIN (SELECT @A := 0) x; Since mysql_derived_fill will, for UNCACHEABLE_DEPENDENT tables, drop all rows and repopulate, we relax the condition at line 1204: rather than assume all uncacheable values prevent early return, we now allow an early return for uncacheable values other than UNCACHEABLE_DEPENDENT. In general, we only populate derived tables once unless they're dependent tables.
Showing
Please register or sign in to comment