Repository navigation
Conversation
Errno 1002 (SQLSTATE 42601) was refused as having no established phase. Snowflake raises it from the parser for some malformed statements, with a message that itself starts with "syntax error", such as ALTER WAREHOUSE ... ADD TABLES with no table list: "syntax error line At least one table name is required for ADD TABLES operations ...". Errno 1002 is now a syntax error only when its message starts with "syntax error"; any other 1002 message stays refused.
Errno 1002 under the SQL compilation error prefix was placed as semantic, and inside an uncaught exception as runtime. As a parser errno, either could be a syntax error published under the wrong phase, so both are now refused, the same way 1003 inside an uncaught exception is. The docs list the 1002 rule on its own and say it reads the message in any case and ignores SQLSTATE.
Contributor
Author
|
Replaced by #197: the same change, rebased onto 0.7.0 with both commit subjects as chore(syntax-receipts): so the rebase merge queue doesn't cut an empty release. Opened as a new PR rather than force-pushing this branch. |
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.
Why
The receipt importer refused every row with errno 1002 as having no established phase. Snowflake's parser raises 1002 for some malformed statements, and the message itself says so:
ALTER WAREHOUSE … ADD TABLESandDROP TABLESwith no table list return errno 1002, SQLSTATE 42601, "syntax error line At least one table name is required for ADD TABLES operations at position {1} unexpected '{2}'." Two captured rows are unimported because of this.Changes
fix(syntax-receipts): errno 1002 is a
syntax_errorwhen its message starts withsyntax error(any case, any SQLSTATE).fix(syntax-receipts): every other errno 1002 is refused, including one under the
SQL compilation errorprefix (formerly semantic) or inside an uncaught exception (formerly runtime), so a parser error can't be published under another phase. No published receipt has errno 1002 in either form.The docs list the 1002 rule on its own, in the order the code applies it. Classify tests cover the syntax message, another message, the compilation prefix and the uncaught exception.
Re-importing the existing runs with this importer places exactly the two ADD/DROP TABLES rows as syntax errors and changes nothing else. Nothing is re-recorded. The six earlier errno 1002 receipts were already published as syntax errors.
Verification
uv run pytest tests/unit/scripts/syntax_receipts/: 80 passed; each new test fails when its rule is reverted.ruff checkandruff format --checkon the touched paths.