Support DBs without LATERAL JOINS - #917
Open
phdoerfler wants to merge 1 commit into
Open
Conversation
SQL Server emits OFFSET 0 ROWS after a root ORDER BY now, where it only did so in subqueries before.
phdoerfler
force-pushed
the
topic/no-lateral-join-hooks
branch
from
August 28, 2026 22:25
b9d0196 to
b323089
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR makes support for LATERAL JOINS optional. This has been extracted out of the SQLite branch since it can stand on its own. This way it might be easier to review. It moves the two decisions a backend without lateral joins has to make out of
sql-coreand behind abstract hooks.Two abstract members on
SqlMappingLikenormalizeOffsetLimitsays how a select'sOFFSET/LIMITis fixed up before it is rendered, andunionBranchToFragmenthow one branch of a union is rendered.defaultOffsetForSubqueryis gone, since the first of those covers what it did.I decided to leave those two abstract and not provide a default implementation. I am not aware of any implementation of
SqlMappingLikeoutside of this repo. And if there is, all it has to do is implement two small methods.SQL Server's generated SQL changes
SQL Server now emits
OFFSET 0 ROWSafter anORDER BYat the root of a query, where before it did so only in subqueries. The rows and their order are unchanged; only the text is. Keeping the old text would have meant passing a "subquery or root?" boolean through the new hook, so I took the text change.