-
Notifications
You must be signed in to change notification settings - Fork 40
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
Pagination broken for composite keys in version 9 #65
Comments
Please upgrade to v0.10.0 to see if it works. |
Version 0.10.0 has the same problem - in fact I think the generated query is the same as v9
From: Ben Who ***@***.***>
Reply-To: benjamin658/typeorm-cursor-pagination ***@***.***>
Date: Sunday, October 30, 2022 at 7:10 PM
To: benjamin658/typeorm-cursor-pagination ***@***.***>
Cc: Stuart Faircloth ***@***.***>, Author ***@***.***>
Subject: Re: [benjamin658/typeorm-cursor-pagination] Pagination broken for composite keys in version 9 (Issue #65)
Please upgrade to v0.10.0 to see if it works.
—
Reply to this email directly, view it on GitHub<#65 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AOAIFGCM6ZCVVZLDUBB5O6DWF4TBBANCNFSM6AAAAAARSDU4LE>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
Your privacy and security are important to us. See our privacy policy (Canada https://www.capitalgroup.com/individual/ca/en/about/legal.html, Europe & Asia https://www.capitalgroup.com/content/sites/the-capital-group/entry-page/shared/privacy.html, United States https://www.capitalgroup.com/individual/privacy.html).
|
Here is a sample dataset and generated queries that shows the problem: Col1 Col2 1st query – paging 2 rows at a time Select Col1, Col2 Results: 2nd query Results: As you can see in the above results – there are rows missing |
Your original algorithm would have generated select col1, col2 The above also has a flaw. select col1, col2 or in general for 3 columns: select col1, col2, col3 |
Here is an implementation of Paginator.buildCursorQuery that pages correctly for composite keys:
|
@ stuartf123 Could you send a PR with your implementation? I really appreciate it. |
Pagination does not work for composite keys in version 9.x (works in version 6.x)
Below are version 9 and version 6 generated code (issuer_id, parent_issuer_id, start_date and source_id are the composite keys). As you can see the criteria to add the nth page is different between the 2.
The difference in the 'where' criteria results in the application only iterating over a subset of the data in v9.x
version 9.x
version 6.x
The text was updated successfully, but these errors were encountered: