You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Konstantin Orlov (Jira)" <ji...@apache.org> on 2025/11/26 14:03:00 UTC

[jira] [Commented] (CALCITE-6180) Append possibility to escape backslash in LIKE expression

    [ https://issues.apache.org/jira/browse/CALCITE-6180?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18040827#comment-18040827 ] 

Konstantin Orlov commented on CALCITE-6180:
-------------------------------------------

Just checked ANSI SQL 99, and turns out it is pretty straightforward on how to treat free escape character:
{code}
8.5 <like predicate> General Rules 3) b)
    i) If an <escape character> is specified, then:
        2) If there is not a partitioning of the string PCV into substrings such that each substring has length 1 (one)
             or 2, no substring of length 1 (one) is the escape character ECV, and each substring of length 2 is the 
             escape character ECV followed by either the escape character ECV, an <underscore> character, or the 
             <percent> character, then an exception condition is raised: data exception — invalid escape sequence.
{code}

In other words, in case of free escape character {{data exception — invalid escape sequence}} must be raised, and this is enforced by standard.

> Append possibility to escape backslash in LIKE expression
> ---------------------------------------------------------
>
>                 Key: CALCITE-6180
>                 URL: https://issues.apache.org/jira/browse/CALCITE-6180
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.36.0
>            Reporter: Evgeny Stanilovsky
>            Priority: Major
>              Labels: pull-request-available
>
> The expression below must be processed correctly and return positive result
> {noformat}
> select 'Dev\ops' like 'Dev#\ops' escape '#';
> {noformat}
> Insted it returns :
> Invalid escape sequence exception.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)