• Georgi Kodinov's avatar
    Bug#34773: query with explain extended and derived table / other table · 89d2b8ef
    Georgi Kodinov authored
    crashes server
    
    When creating temporary table that contains aggregate functions a 
    non-reversible source transformation was performed to redirect aggregate
    function arguments towards temporary table columns.
    This caused EXPLAIN EXTENDED to fail because it was trying to resolve
    references to the (freed) temporary table.
    Fixed by preserving the original aggregate function arguments and
    using them (instead of the transformed ones) for EXPLAIN EXTENDED.
    
    mysql-test/r/explain.result:
      Bug#34773: test case
    mysql-test/t/explain.test:
      Bug#34773: test case
    sql/item.cc:
      Bug#34773: use accessor functions instead of public members
    sql/item_sum.cc:
      Bug#34773: 
       - Encapsulate the arguments into Item_sum and
         provide accessor and mutator methods 
       - print the orginal arguments (if present)
         in EXPLAIN EXTENDED
       - preserve the original arguments list.
    sql/item_sum.h:
      Bug#34773: 
       - Encapsulate the arguments into Item_sum and
         provide accessor and mutator methods 
       - print the orginal arguments (if present)
         in EXPLAIN EXTENDED
       - preserve the original arguments list.
    sql/opt_range.cc:
      Bug#34773: use accessor functions instead of public members
    sql/opt_sum.cc:
      Bug#34773: use accessor functions instead of public members
    sql/sql_select.cc:
      Bug#34773: use accessor functions instead of public members
    89d2b8ef
opt_sum.cc 32.5 KB