Repository navigation
Conversation
Snowflake reads a LIMIT with no row count after it as an alias of the item before it (import 163): SELECT 1 LIMIT names its column LIMIT, FROM t LIMIT names the table, which LIMIT.a then reads, and LIMIT before WHERE, ORDER BY, a second LIMIT, ) or ; is an alias too. A bare OFFSET before ), ; or the end is the same. LIMIT OFFSET 1 stays a syntax error (1003), so OFFSET does not end an alias LIMIT. LIMIT with a count, LIMIT NULL and other bare LIMITs keep their row-limit reading. No receipted statement changes verdict; the everyday corpus query SELECT order_id FROM orders LIMIT now translates, with the alias quoted as "LIMIT".
A flat chain of 513 or more UNION ALL branches is refused with SQ0105, and its help said to move nested parts into common table expressions, which does not fit a flat chain. Counting the chain as one level is not safe: convert overflows its stack on 513 branches (it recurses per branch), so the depth limit stays. When the statement holds more than 250 set operators, SQ0105's help now says to put at most 250 branches in each common table expression and combine them with the same operator; 1,000 branches split that way check and convert. Other deep statements keep the general help.
Contributor
Author
|
Closing: SQLQuack lands through local-gate trains, not PR merges (D94), so open PRs only add clutter (D628/D630). The branch is kept. Any work here that isn't on main yet is tracked by the train owner and lands through a train. |
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.
Follow-up to #89 (D186). It is based on #89's branch
fix/d150-v3, so the diff shows only these two commits. Once #89 lands, I'll rebase this PR onto main, retarget it to main, re-derive the corpus rates and gate it.Commits
SELECT 1 LIMITnames its column LIMIT.FROM t LIMIT, LIMIT names the table, soLIMIT.areads its column.;,), WHERE, ORDER BY, another LIMIT or the end of input follows it.;,)or the end of input follows it.LIMIT OFFSET 1stays a syntax error (1003). LIMIT with a row count, and LIMIT NULL, keep their row-limit meaning.convertrecurses once per branch and overflows its stack at 513 branches.Evidence
SELECT order_id FROM orders LIMITmoves from refused SQ0003 to translated, with the alias quoted as"LIMIT". The translation rates move to 288 of 436 (strict) and 357 of 436 (repository).checkandconvert.