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

Conditional_non_pii_keys behavior is not consistent with original LIKE behavior #230

Open
justjkk opened this issue May 18, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@justjkk
Copy link
Contributor

justjkk commented May 18, 2021

// replace sql patterns with regex patterns
// TODO: cover all cases :pray
pattern = strings.ReplaceAll(pattern, "%", ".*")
pattern = "^" + pattern + "$"
regex, ok := m.regexes[pattern]

The above logic is not consistent with the LIKE functionality since:

  1. _ in LIKE should be interpreted as . in regex. (Ref: SQL LIKE)
  2. ., ?, etc.. in LIKE should be treated as literal and should not have special meaning.
  3. LIKE query in MySQL can be case sensitive when run on a column that uses case insensitive collation(eg: utf8_general_ci).
@justjkk
Copy link
Contributor Author

justjkk commented May 18, 2021

Checked the existing definitions and found that there is pretty much no impact. However, we should look into deprecating the % syntax in favor of regex based ones.

@alok87 alok87 added the bug Something isn't working label May 20, 2021
@alok87 alok87 changed the title conditional_non_pii_keys behavior is not consistent with original LIKE behavior Conditional_non_pii_keys behavior is not consistent with original LIKE behavior May 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants