Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL v2: double backslash being ignored in like expression. #1068

Open
lentil1016 opened this issue Jun 20, 2024 · 1 comment
Open

SQL v2: double backslash being ignored in like expression. #1068

lentil1016 opened this issue Jun 20, 2024 · 1 comment

Comments

@lentil1016
Copy link

lentil1016 commented Jun 20, 2024

I found like '%START//END' or like '%START/END' both match 'STARTEND', instead of 'START/END'.
And that's unexpected, like backslash is being ignored in expression.

I can see the codes dealing with \_ and \% cases, why not the \\ case?

for textIdx < textLen {
// handle escaped characters -> pattern needs to increment two places here
if patternIdx < patternLen-1 && pattern[patternIdx] == '\\' &&
((pattern[patternIdx+1] == '_' || pattern[patternIdx+1] == '%') &&
pattern[patternIdx+1] == text[textIdx]) {
patternIdx += 2
textIdx += 1

@lentil1016 lentil1016 changed the title SQL: double backslash being ignored in like expression. SQL v2: double backslash being ignored in like expression. Jun 20, 2024
@Cali0707
Copy link
Contributor

Hey @lentil1016 are you able to recreate this with the current code on main? I can't recreate it from your examples. Additionally, if you look in the test files (specifically

- name: Exact match (2)
expression: "'ab\\c' LIKE 'ab\\c'"
result: true
) we do have some code checking that the \\ is handled correctly.

Maybe you could provide a test case in the format of that file that reproduces the bug you are seeing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants