• unknown's avatar
    Fix LP BUG#682683 · c8413dba
    unknown authored
      
    Analysis:
    The fix for LP BUG#680846 avoids evaluation of constant expressions
    with subqueries in the GROUP/ORDER clauses in the procedure
    remove_const(). The purpose of remove_const is to remove constant
    expressions in the GROUP/ORDER clauses.
      
    In order delay until execution the evaluation of such subqueries,
    they were not removed in the GROUP/ORDER clause. As a result temp
    table creation during execution attempted to create a column in the
    temp table for each constant GROUP/ORDER expression. However, the
    logic in create_tmp_table is to not create temp table columns for
    constant items. The crash was due to a group Item without a
    corresponding column in the temp table for GROUP BY.
      
    Solution:
    The patch adds back removal of constant expressions with subqueries.
    In order for such expressions to be evaluated, so that the server can
    ensure that such subquries return 1 row, the evaluation of these
    expressions is delayed until execution.
    c8413dba
subselect4.test 16.3 KB