• Sergei Petrunia's avatar
    MDEV-31496: Make optimizer handle UCASE(varchar_col)=... · e987b935
    Sergei Petrunia authored
    (Review input addressed)
    (Added handling of UPDATE/DELETE and partitioning w/o index)
    
    If the properties of the used collation allow, do the following
    equivalent rewrites:
    
    1. UPPER(key_col)=expr  ->  key_col=expr
       expr=UPPER(key_col)  ->  expr=key_col
       (also rewrite both sides of the equality at the same time)
    
    2. UPPER(key_col) IN (constant-list)  -> key_col IN (constant-list)
    
    - Mark utf8mb{3,4}_general_ci as collations that allow this.
    - Add optimizer_switch='sargable_casefold=ON' to control this.
      (ON by default in this patch)
    - Cover the rewrite in Optimizer Trace, rewrite name is
      "sargable_casefold_removal".
    e987b935
m_ctype.h 68.2 KB