• Mattias Jonsson's avatar
    Bug#14342883: SELECT QUERY RETURNS NOT ALL · 6592afd5
    Mattias Jonsson authored
    ROWS THAT ARE EXPECTED
    
    For non range/list partitioned tables (i.e. HASH/KEY):
    
    When prune_partitions finds a multi-range list
    (or in this test '<>') for a field of the partition index,
    even if it cannot make any use of the multi-range,
    it will continue with the next field of the partition index
    and use that for pruning (even if it the previous
    field could not be used). This results in partitions is
    pruned away, leaving partitions that only matches
    the last field in the partition index, and will exclude
    partitions which might match any previous fields.
    
    Fixed by skipping rest of partitioning key fields/parts
    if current key field/part could not be used.
    
    Also notice it is the order of the fields in the CREATE TABLE
    statement that triggers this bug, not the order of fields in
    primary/unique key or PARTITION BY KEY ().
    It must not be the last field in the partitioning expression that
    is not equal (or have a non single point range).
    I.e. the partitioning index is created with the same field order
    as in the CREATE TABLE. And for the bug to appear
    the last field must be a single point and some previous field
    must be a multi-point range.
    6592afd5
opt_range.cc 369 KB