Skip to content
  • Sreeharsha Ramanavarapu's avatar
    192ed2ba
    Bug #28145710: SQL_SAFE_UPDATES ERROR IS INSUFFICIENTLY · 192ed2ba
    Sreeharsha Ramanavarapu authored
                   INFORMATIVE
    
    Issue:
    ------
    When memory allocation by range optimizer exceeds
    "range_optimizer_max_mem_size", optimizer chooses a table
    scan.
    
    This can also happen with data truncation when column with
    index is a varchar and value is an integer.
    
    In the DELETE/UPDATE code, the check for SQL_SAFE_UPDATES
    interprets a table scan as the absence of a WHERE clause.
    So it rejects the DML statement with the error indicating
    a violation of the safe update mode.
    
    Solution:
    ---------
    Append the warning (data truncation /
    'range_optimizer_max_mem_size' exceeded) to the
    safe update error. This will allow the user to understand
    why index couldn't be used for the DELETE / UPDATE.
    
    A few other changes:
    1) No error will be thrown for EXPLAIN. This allows the
       user to understand why an index isn't used.
    2) For Multi-Delete / Multi-Update throw the error only if
       the target table chooses a table scan.
    192ed2ba
    Bug #28145710: SQL_SAFE_UPDATES ERROR IS INSUFFICIENTLY
    Sreeharsha Ramanavarapu authored
                   INFORMATIVE
    
    Issue:
    ------
    When memory allocation by range optimizer exceeds
    "range_optimizer_max_mem_size", optimizer chooses a table
    scan.
    
    This can also happen with data truncation when column with
    index is a varchar and value is an integer.
    
    In the DELETE/UPDATE code, the check for SQL_SAFE_UPDATES
    interprets a table scan as the absence of a WHERE clause.
    So it rejects the DML statement with the error indicating
    a violation of the safe update mode.
    
    Solution:
    ---------
    Append the warning (data truncation /
    'range_optimizer_max_mem_size' exceeded) to the
    safe update error. This will allow the user to understand
    why index couldn't be used for the DELETE / UPDATE.
    
    A few other changes:
    1) No error will be thrown for EXPLAIN. This allows the
       user to understand why an index isn't used.
    2) For Multi-Delete / Multi-Update throw the error only if
       the target table chooses a table scan.
Loading