• Gleb Shchepa's avatar
    Bug #52160: crash and inconsistent results when grouping · 0389c6aa
    Gleb Shchepa authored
                by a function and column
    
    The bugreport reveals two different bugs about grouping
    on a function:
    
    1) grouping by the TIME_TO_SEC function result caused
       a server crash or wrong results and
    2) grouping by the function returning a blob caused
       an unexpected "Duplicate entry" error and wrong
       result.
    
    Details for the 1st bug:
    
    TIME_TO_SEC() returns NULL if its argument is invalid (empty
    string for example). Thus its nullability depends not only
    on the nullability of its arguments but also on their values.
    Fixed by (overoptimistically) setting TIME_TO_SEC() to be
    nullable despite the nullability of its arguments.
    
    Details for the 2nd bug:
    
    The server is unable to create indices on blobs without
    explicit blob key part length. However, this fact was
    ignored for blob function result fields of GROUP BY
    intermediate tables.
    Fixed by disabling GROUP BY index creation for blob
    function result fields like regular blob fields.
    0389c6aa
sql_select.cc 550 KB