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

Search logs an error if there are no events in the database #14

Closed
JackBister opened this issue Jan 20, 2021 · 0 comments
Closed

Search logs an error if there are no events in the database #14

JackBister opened this issue Jan 20, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@JackBister
Copy link
Owner

When a search is started, SELECT MAX(id) FROM Events is executed and all queries thereafter are filtered to be less than this ID. This was added to avoid weird behavior when events were being added while a search was executing.

This query does not work when Events is empty, you get the following error message in that case: error when scanning max(id) in FilterStream: sql: Scan error on column index 0, name "MAX(id)": converting NULL to int is unsupported.

There are two ways I can imagine fixing this, the first one being to use a SELECT COUNT(1) FROM Events before issuing the MAX query, and the second being to do a string match on the error, similar to the expectedConstraintViolationForDuplicates check. I think the second option is preferable since the first one incurs a performance hit on all searches for an extreme edge case.

@JackBister JackBister added the bug Something isn't working label Jan 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

1 participant