• Annamalai Gurusami's avatar
    Bug #14211565 CRASH WHEN ATTEMPTING TO SET SYSTEM VARIABLE TO RESULT OF VALUES() · 15f14ff2
    Annamalai Gurusami authored
    Problem:
    
    When the VALUES() function is inappropriately used in the SET stmt the server
    exits.  
    
    set port = values(v);
    
    This happens because the values(v) will be parsed as an Item_insert_value by
    the parser.  Both Item_field and Item_insert_value return the type as
    FIELD_ITEM.  But for Item_insert_value the field_name member is NULL.  In
    set_var constructor, when the type of the item is FIELD_ITEM we try to access
    the non-existent field_name. 
    
    The class hierarchy is as follows:
    Item -> Item_ident -> Item_field -> Item_insert_value
    
    The Item_ident::field_name is NULL for Item_insert_value.  
    
    Solution:
    
    In the parsing stage, in the set_var constructor if the item type is
    FIELD_ITEM and if the field_name is non-existent, then it is probably
    the Item_insert_value.  So leave it as it is for later evaluation.
    
    rb://2004 approved by Roy and Norvald.
    15f14ff2
set_var.h 45.8 KB