Make sort order consistent in split queries #34097
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Make sort order consistent in split queries between the parent query and its occurrences in subqueries for collection includes.
Include_collection_skip_take_no_order_by
,Include_collection_skip_no_order_by
) due to this missing sort order in skip/take queries have been made non-throwing since the same ordering from the parent query is now applied to the subquery that lacked sorting.All the changes in the tests that add or change an
ORDER BY
are such that the change makes the subquery exactly match the parent query.Since the same deterministic sorting was already being appended to the parent query, I didn't go down the paths discussed in #26808 of checking whether existing sorts on the query are already perfectly deterministic.
Fixes #26808
(Apologies for not asking for permission to work on this first - this started out as an exploration of whether I could even figure out how to approach fixing an issue like this).