• Evgeny Potemkin's avatar
    Bug#37870: Usage of uninitialized value caused failed assertion. · 3c49cb07
    Evgeny Potemkin authored
    The convert_constant_item function converts a constant to integer using
    field for condition like 'field = a_constant'. In some cases the
    convert_constant_item is called for a subquery when outer select is already
    being executed, so convert_constant_item saves field's value to prevent its
    corruption. For EXPLAIN and at the prepare phase field's value isn't
    initialized yet, thus when convert_constant_item tries to restore saved
    value it fails assertion.
    
    Now the convert_constant_item doesn't save/restore field's value if it's
    haven't been read yet. Outer constant values are always saved.
    
    mysql-test/r/explain.result:
      Added a test case for the bug#37870.
    mysql-test/t/explain.test:
      Added a test case for the bug#37870.
    sql/item_cmpfunc.cc:
      Bug#37870: Usage of uninitialized value caused failed assertion.
      Now the convert_constant_item doesn't save/restore field's value if it's
      haven't been read yet. Outer constant values are always saved.
    3c49cb07
SETUP.sh 6.5 KB