• Nikita Malyavin's avatar
    MDEV-17890 Server crash on DELETE with YEAR field with truncated expr · 0e9ba176
    Nikita Malyavin authored
    The failing reason was inconsistent truncation rules: the value of virtual
    column could have been evaluated to '2000' sometimes instead of '0000' for
    value 'a'.
    
    The reason why `c YEAR AS ('aaaa')` was not evaluated same is that len=4 is
    a special case insidew Field_year::store.
    
    The correct fix is: always evaluate a bad value to 0000 instead 2000.
    The truncated values should be evaluated as usual.
    
    $support_virtual_index is finally changed to 1 in gcol.gcol_ins_upd_innodb,
    which is also enough for testing.
    
    The test from original bug report is also added.
    0e9ba176
gcol_ins_upd_innodb.result 19.6 KB