• Tatiana A. Nurnberg's avatar
    Bug#49487: crash with explain extended and group_concat in a derived table · 1fc1f462
    Tatiana A. Nurnberg authored
    When EXPLAIN EXTENDED tries to print column names, it checks whether the
    referenced table is CONST (in which case, the column's value rather than
    its name will be printed). If no proper table is reference (i.e. because
    a derived table was used that has since gone out of scope), this will fail
    spectacularly.
    
    This ports an equivalent of the fix for Bug 43354.
    
    mysql-test/r/func_gconcat.result:
      Show that EXPLAIN EXTENDED on a GROUP_CONCAT() on a derived table
      no longer crashes the server.
    mysql-test/t/func_gconcat.test:
      Show that EXPLAIN EXTENDED on a GROUP_CONCAT() on a derived table
      no longer crashes the server.
    sql/item_sum.cc:
      Do not de-ref what cannot be, that is, temp-tables that have gone away.
      This is of questionable utility anyway, since our deref has the sole
      purpose of checking whether the table is const (in which case, we'll
      substitute the column with its value in EXPLAIN EXTENDED - that is all).
    1fc1f462
func_gconcat.result 42 KB