Repository navigation
fix(syntax): parse Snowflake ALTER APPLICATION ROLE and DATABASE ROLE by their grammar - #48
Merged
Merged
Conversation
… to the role parser The ALTER APPLICATION and ALTER DATABASE matchers took the kind word before checking for a following ROLE, so role actions such as RENAME TO and SET COMMENT were refused.
… by their grammar Both kinds take RENAME TO, SET or UNSET; when one of those follows the kind, Snowflake reads ROLE as the application or database name. All 109 receipted role cases agree: 58 parse and 51 are refused.
Contributor
Author
kvlonge
added a commit
that referenced
this pull request
Nov 4, 2026
…ified) Basis: main 2f0c38a (PR #46, #48), catalogue b7d45d5, evidence e68cfb2, parser tree 4b9e8db. - 86 forms approved (functions 34, ddl 20, scripting 13, expressions 6, transaction_session 6, utility 5, query 2): newly eligible forms, forms whose earlier findings or withholds are fixed (DROP SEQUENCE RESTRICT included), and re-reads of reviews made stale by re-rendered cases. - Not approved: 12 catalogue findings and 6 parser withholds (INSERT VALUES DEFAULT, SELECT ALL, APPROX_COUNT_DISTINCT DISTINCT, TIMESTAMP WITHOUT TIME ZONE, START TRANSACTION NAME, USE SECONDARY ROLES list). Checker at 2f0c38a: valid, 3476 forms, 0 problems; 1468 of 3348 verified.
kvlonge
added a commit
that referenced
this pull request
Nov 5, 2026
…on names and role lists From the omission audit after #46 and #48: - SELECT ALL sets select.all; it was consumed and dropped. - An aggregate of several arguments, such as APPROX_COUNT_DISTINCT ( DISTINCT a , b ), keeps distinct; the generic call dropped it. - TIMESTAMP [ ( p ) ] WITHOUT TIME ZONE is TIMESTAMP_NTZ, as its synonyms are, not bare TIMESTAMP (whose meaning follows TIMESTAMP_TYPE_MAPPING). - START TRANSACTION NAME n keeps n as the name, quoting kept, apart from NAME. - USE SECONDARY ROLES lists each role with its quoting in use.roles.
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.
Fixes a regression from #45:
ALTER APPLICATION ROLEandALTER DATABASE ROLEwere routed into the new ALTER APPLICATION / ALTER DATABASE parsers, which refused role actions such asRENAME TOandSET COMMENT. Before #45 these fell to the raw fallback, which accepted everything.The fix parses both kinds by their grammar:
[ IF EXISTS ] <name>thenRENAME TO <name>,SET <properties>orUNSET <properties>. WhenRENAME,SETorUNSETfollows the kind,ROLEis read as the application or database name, as Snowflake does (those cases are recorded with errno 2003).Checked against every receipted case for both kinds (109): the 58 that Snowflake parsed are accepted and the 51 it refused with a syntax error are refused. The test table in
test_fixes.rscarries six of them.Gate:
make check-merge RECORDER=0exited 0 on head 2f0c38a (main 3d11e66 merged in).