• Varun Gupta's avatar
    MDEV-24519: Server crashes in Charset::set_charset upon SELECT · 390de205
    Varun Gupta authored
    The query causing the issue here has implicit grouping for we
    have to produce one row with special values for the aggregates
    (depending on each aggregate function), and NULL values for all
    non-aggregate fields.
    
    The subselect item where implicit grouping was being done,
    null_value for the subselect item was not being set for
    the case when the implicit grouping produces NULL values
    for the items in the select list of the subquery.
    This which was leading to the crash.
    
    The fix would be to set the null_value when all the values
    for the row column have NULL values.
    
    Further changes are
    
    1) etting null_value for Item_singlerow_subselect only
       after val_* functions have been called.
    2) Introduced a parameter null_value_inside to Item_cache that
       would store be set to TRUE if any of the arguments of the
       Item_cache are null.
    
    Reviewed And co-authored by Monty
    390de205
item_subselect.h 51 KB