-
Notifications
You must be signed in to change notification settings - Fork 2.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
fix(mssql): Generate valid SQL for withRecursive() [#4514] #4639
fix(mssql): Generate valid SQL for withRecursive() [#4514] #4639
Conversation
bf06fb6
to
c1aa2ed
Compare
mssql forbids use of the RECURSIVE keyword required by some other dialects. The approach taken here maximizes subclass reuse and leaking changes to the query outside `with` generation. If we skipped restoring the recursive labels using `undoList`, the SQL would generate fine here, but the test suite fails: The next-tested driver fails its test, because clone() preserves the top-level statement's `recursive = false` change, so it's shy one `RECURSIVE` in the generated SQL.
c1aa2ed
to
0ffc4b6
Compare
first pass at integration test had errors on a couple platforms i wasn't testing locally:
i revised it to omit the keys and fkeys (they weren't the point of the test - just superfluous "realism"), and everything passed the next time around. 👍 |
Thanks a lot! Could you also add same for Oracle? |
Started poking at it - got Oracle working locally so I can iterate on it. Oracle requires a column list to be valid ( But while trying to check that workaround, I somehow got the query compiler to blow the stack with recursion - haven’t had a chance to untangle that unexpected diversion just yet. |
Recursion was due to code like |
Opened #4652 to apply the parallel change made here. We'll need to work out a querybuilder API change to be able to successfully issue rCTE queries on Oracle, though, in order to accommodate its requirement of a column list. |
Released in 0.95.11 |
mssql forbids use of the RECURSIVE keyword required by some other
dialects.
The approach taken here maximizes subclass reuse and leaking
changes to the query outside
with
generation. If we skippedrestoring the recursive labels using
undoList
, the SQL wouldgenerate fine here, but the test suite fails:
The next-tested driver fails its test, because clone() preserves the
top-level statement's
recursive = false
change, so it's shy oneRECURSIVE
in the generated SQL.This addresses the mssql portion of [#4514], but not the oracledb issues.
If this approach to omitting RECURSIVE looks good, I can apply the same to the
oracledb dialect. (Supporting a column alias list as separate argument, as Oracle
requires for recursive CTEs, would require deeper changes.)