Skip to content
  • Knut Anders Hatlen's avatar
    097284a1
    Bug#32446508: INCONSISTENT HANDLING OF LIKE WITH AN EMPTY ESCAPE SEQUENCE · 097284a1
    Knut Anders Hatlen authored
    MySQL has traditionally interpreted an empty value in the ESCAPE
    clause (ESCAPE '') as no escape character. But when either of the
    first two arguments to LIKE is a string with a multi-byte character
    set, the empty value is interpreted as meaning backslash should be
    used as escape character.
    
    This patch makes LIKE interpret ESCAPE '' the same way regardless of
    the character set, and it's taken as meaning there is no escape
    character.
    
    It is done by making Item_func_like::eval_escape_clause() check for an
    empty escape sequence and handle it before it gets to the part where
    it has different branches for different kinds of character sets.
    
    Additionally, this patch makes eval_escape_clause() raise an error if
    the specified escape character cannot be converted to the target
    character set. The original behavior was to silently fall back to
    using backslash as escape character.
    
    Change-Id: I3f9789f3564664154c2bf720b4f81ac5ff6e4fdd
    097284a1
    Bug#32446508: INCONSISTENT HANDLING OF LIKE WITH AN EMPTY ESCAPE SEQUENCE
    Knut Anders Hatlen authored
    MySQL has traditionally interpreted an empty value in the ESCAPE
    clause (ESCAPE '') as no escape character. But when either of the
    first two arguments to LIKE is a string with a multi-byte character
    set, the empty value is interpreted as meaning backslash should be
    used as escape character.
    
    This patch makes LIKE interpret ESCAPE '' the same way regardless of
    the character set, and it's taken as meaning there is no escape
    character.
    
    It is done by making Item_func_like::eval_escape_clause() check for an
    empty escape sequence and handle it before it gets to the part where
    it has different branches for different kinds of character sets.
    
    Additionally, this patch makes eval_escape_clause() raise an error if
    the specified escape character cannot be converted to the target
    character set. The original behavior was to silently fall back to
    using backslash as escape character.
    
    Change-Id: I3f9789f3564664154c2bf720b4f81ac5ff6e4fdd
Loading