• unknown's avatar
    Bug #22367: Optimizer uses ref join type instead of eq_ref for simple join on · ffc1facc
    unknown authored
                 strings
    MySQL is setting the flag HA_END_SPACE_KEYS for all the keys that reference
    text or varchar columns with collation different than binary.
    This was done to handle correctly the situation where a lookup on such a key
    may return more than 1 row because of the presence of many rows that differ
    only by the amount of trailing space in the table's string column.
    Inserting such values however appears to violate the unique checks on 
    INSERT/UPDATE. Thus that flag must not be set as it will prevent the optimizer
    from choosing a faster access method.
    This fix removes the setting of the HA_END_SPACE_KEYS flag.
    
    
    include/my_base.h:
      Bug #22367: Optimizer uses ref join type instead of eq_ref for simple join on 
                   strings
       - disabled HA_END_SPACE_KEY as it's no longer needed
    mysql-test/r/func_str.result:
      Bug #22367: Optimizer uses ref join type instead of eq_ref for simple join on 
                   strings
       - fixed explain in an existing case
    mysql-test/r/merge.result:
      Bug #22367: Optimizer uses ref join type instead of eq_ref for simple join on 
                   strings
       - fixed explain in an existing case
    mysql-test/r/select.result:
      Bug #22367: Optimizer uses ref join type instead of eq_ref for simple join on 
                   strings
       - test case
    mysql-test/r/subselect.result:
      Bug #22367: Optimizer uses ref join type instead of eq_ref for simple join on 
                   strings
       - fixed explain in an existing case
    mysql-test/t/select.test:
      Bug #22367: Optimizer uses ref join type instead of eq_ref for simple join on 
                   strings
       - test case
    ffc1facc
merge.result 16.8 KB