-
Notifications
You must be signed in to change notification settings - Fork 15
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
underscores in project name kills database performance #1725
Comments
Hi @XzzX, I looked into this and noticed that there are two possible options to change this behavior, either: But in both cases it fails in our test suits as we are using SQLite. Maybe you can still give it a try on PostgreSQL. Best, Jan |
If it breaks SQLite we should guard it with the |
@pmrv is the better person to test it. I just saw this kind of queries in the log for long running queries. But I do not know where the originate from. |
I'd rather not remove sqlite capability. I briefly googled this when @XzzX opened the issue and apparently the best solution would be to use the formatting support of sqlalchemy rather than doing the escaping manually, but that would require us to rewrite our SQL calls to be of the form conn.execute("SELECT foo FROM bar where project = :name", name=...) rather than conn.execute("SELECT foo FROM bar where project = %s" % name) that we currently do, but it wasn't straightforward in the ten minutes I gave it. |
Alone for security reasons we should do this. Due to RLS not as bad but this is prone to SQL injection. |
Turns out I was wrong, we do construct the queries properly in |
_
stands for any single character inLIKE
statements. https://www.postgresql.org/docs/current/functions-matching.html#FUNCTIONS-LIKETo counter this we need to escape any unwanted
%
and_
characters.The text was updated successfully, but these errors were encountered: