-
Notifications
You must be signed in to change notification settings - Fork 415
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
Bug: Keyset pagination on date columns behave incorrectly #749
Comments
@maikdijkstra Thanks for you report. That is a documented quirk of SQLite that should not happen with other DBs with proper time types. The serialialization of the page param uses to_json, that misses the microseconds, and the comparison of time columns in SQLite (that includes microseconds by default) is alphanumeric, hence the ordering mismatch. Not sure we can consider it a pagy bug: it looks more like a specific inconsistency of ActiveRecord to me ATM. |
Not a bug indeed, you can encode the right json time values for your SQLite specific storage, by setting the precision to microseconds right after the ActiveSupport::JSON::Encoding.time_precision = 6 I will add that to the |
Thank you for you report. |
I didn't find any simple way to configure the Released in 9.3 |
👀 Before submitting...
🧐 REQUIREMENTS
💬 Description
When using the new keyset pagination feature, I noticed an issue with paginating a query which first orders on a possibly non-unique timestamp like
created_at
and then a unique identifier likeid
. Together, this ordering is unique. However, due to the truncation of the timestamp when creating@pagy.next
the pagination is not correct and some records appear on multiple pages.keyset_ar.ru:
The text was updated successfully, but these errors were encountered: