-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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
[10.x] Fix sql server paging problems #47763
Conversation
* @param \Illuminate\Database\Query\Builder $query | ||
* @return array | ||
*/ | ||
protected function sortBindingsForSubqueryOrderBy($query) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unused and not cleaned up in PR: #44937
* @param \Illuminate\Database\Query\Builder $query | ||
* @return string | ||
*/ | ||
protected function compileRowConstraint($query) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unused and not cleaned up in PR: #44937
Thank you! |
wait it seemed sql server was still throwing errors :D |
this might implicitly break distinct combined with limit statement. |
here is more context on the ordering issue: https://stackoverflow.com/a/20050403/1275832 and here as well: https://web.archive.org/web/20160808070425/https://blogs.msdn.microsoft.com/conor_cunningham_msft/2008/08/27/no-seatbelt-expecting-order-without-order-by/ |
This reverts commit 53b02b3.
I fixed it long ago in this PR: #39863
But now the problem is back since this PR: #44937 (comment)
Problem
if column 0 is not identical to the SQL server fragmentation/page order (which is not identical to the primary key order). It can be that items on page 1 are also shown on later pages and visa versa, items are missing that should be on page 1.
Solution
To also page when there is a limit set, OR an offset set, this way we guarentuee items are not mistakenly sorted wrongly.
alternative solutions
Always add select 0 to make sure order is always followed, even when there is no limit and offset. Although this is less of na issue.
Breaking changes
I removed 2 protected methods that were no longer used since #44937.
Since the subset using sql server drivers is very small there is a very, very small change any developer had these methods overwritten or used. even if someone had overwritten them it wouldn't change a thing. and if someone used them, they were probably not valid anymore anyways.