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

Sqlite backend's prefix match cannot deal with '%' characters #1018

Closed
mlschroe opened this issue Jan 27, 2020 · 3 comments · Fixed by #1085
Closed

Sqlite backend's prefix match cannot deal with '%' characters #1018

mlschroe opened this issue Jan 27, 2020 · 3 comments · Fixed by #1085
Labels
Milestone

Comments

@mlschroe
Copy link
Contributor

It should either escape the '%' chars or use a custom match function.

@pmatilai pmatilai added the bug label Jan 31, 2020
@pmatilai pmatilai added this to the 4.16.0 milestone Feb 5, 2020
pmatilai added a commit to pmatilai/rpm that referenced this issue Feb 26, 2020
SQL LIKE is a quirky thing when you only really want exact matches
on a substring. Which begs the question, if we want exact matches on
substring then why not do just that? Why not, indeed. This avoids
escaping madness and the need to use custom extensions for such
a mundane, trivial thing.

Fixes: rpm-software-management#1018
@mlschroe
Copy link
Contributor Author

I learned a bit more about sqlite in another project. Turns out that using a custom match function is much slower than the LIKE version, because of sqlite's LIKE optimization: https://www.sqlite.org/optoverview.html#the_like_optimization

So I think we should go back to use LIKE and escape the % and _ characters.

@mlschroe mlschroe reopened this Mar 24, 2020
@pmatilai
Copy link
Member

Being somewhat slower doesn't make it wrong. I'd rather leave it alone unless the performance actually turns out to be a problem.

@pmatilai
Copy link
Member

Closing to avoid anybody thinking that %'s can't be handled. Optimizations oare a whole different matter.

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

Successfully merging a pull request may close this issue.

2 participants