• gkodinov/kgeorge@magare.gmz's avatar
    Bug #27807. · 6badb08c
    gkodinov/kgeorge@magare.gmz authored
    Non-correlated scalar subqueries may get executed
    in EXPLAIN at the optimization phase if they are
    part of a right hand sargable expression.
    If the scalar subquery uses a temp table to 
    materialize its results it will replace the 
    subquery structure from the parser with a simple
    select from the materialization table.
    As a result the EXPLAIN will crash as the 
    temporary materialization table is not to be shown
    in EXPLAIN at all.
    Fixed by preserving the original query structure
    right after calling optimize() for scalar subqueries
    with temp tables executed during EXPLAIN.
    6badb08c
sql_select.h 20.8 KB