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

SqfliteDatabaseException: DatabaseException(near "nulls": syntax error (code 1 SQLITE_ERROR): , while compiling: select p.b... #5691

Closed
sentry-io bot opened this issue Oct 12, 2024 · 1 comment · Fixed by #5695
Assignees
Labels
🐛 bug Something isn't working database

Comments

@sentry-io
Copy link

sentry-io bot commented Oct 12, 2024

Sentry Issue: SMOOTHIE-3RJ

SqfliteDatabaseException: DatabaseException(near "nulls": syntax error (code 1 SQLITE_ERROR): , while compiling: select p.barcode from gzipped_product p left outer join product_last_access a on p.barcode = a.barcode where p.lc is null or p.lc != ? order by a.last_access desc nulls last limit ?) sql 'select p.barcode from gzipped_product p left outer join product_last_access a on p.barcode = a.barcode where p.lc is null or p.lc != ? order by a.last_access desc nulls last limit ?' args [pt, 20]

@monsieurtanuki
Copy link
Contributor

Very strange bug, that I couldn't reproduce.
It happens only once, in a "dev mode" action: refresh all the products (potentially with a new language).
The bug itself is a syntax error on a const String: that should be easy to reproduce. But it's not.
The trouble seems to be with a nulls last syntax, that seem to be optionally accepted by SQLite implementation, cf. https://pkg.go.dev/github.com/markdessain/sqlitego/lib#Xsqlite3HasExplicitNulls
We don't seem to have control over that option, which is bad news: we cannot 100% trust the version number in pubspec.yaml.
The solution would be to try with the nulls last syntax, and without it - as a fallback (functionally that's not that bad).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working database
Development

Successfully merging a pull request may close this issue.

1 participant