• Igor Babaev's avatar
    MDEV-20773 Error from UPDATE when estimating selectivity of a range · ef4d0994
    Igor Babaev authored
    This bug could affect multi-update statements as well as single-table
    update statements processed as multi-updates when the where condition
    contained a range condition over a non-indexed varchar column. The
    optimizer calculates selectivity of such range conditions using histograms.
    For each range the buckets containing endpoints of the the range are
    determined with a procedure that stores the values of the endpoints in the
    space of the record buffer where values of the columns are usually stored.
    For a range over a varchar column the value of a endpoint may exceed the
    size of the buffer and in such case the value is stored with truncation.
    This truncations cannot affect the result of the calculation of the range
    selectivity as the calculation employes only the beginning of the value
    string. However it can trigger generation of an unexpected error on this
    truncation if an update statement is processed.
    This patch prohibits truncation messages when selectivity of a range
    condition is calculated for a non-indexed column.
    
    Approved by Oleksandr Byelkin <sanja@mariadb.com>
    ef4d0994
opt_range.cc 522 KB