Repository navigation
fix(syntax): parse Snowflake ALTER of policies and account-level objects - #43
Merged
Merged
Conversation
Snowflake ALTER of these kinds used to fall back to an opaque statement, which accepted their documented negatives. They now parse into AlterObject: - Policies: the AGGREGATION, AUTHENTICATION, BACKUP, DATA MOVEMENT, FEATURE, INGRESS, JOIN, MAINTENANCE, MASKING, MULTI PARTY APPROVAL, NETWORK, PACKAGES, PASSWORD, SESSION and SNAPSHOT policies, and NETWORK RULE. ALTER SESSION POLICY no longer falls into ALTER SESSION. That covers BODY -> <expr>, AS bodies and ADD/REMOVE lists. A SET of an AS body alone is refused, as the receipts show. - FAILOVER and REPLICATION GROUP: ADD/REMOVE to the allowed lists, MOVE to a group of the same kind, PRIMARY (failover only), REFRESH, RESUME, SUSPEND [IMMEDIATE], RENAME, SET/UNSET and TAG. A SET list value runs to the next `<name> =`, and an integration type may be two words. - CONNECTION: PRIMARY, ENABLE/DISABLE FAILOVER, SET/UNSET COMMENT. - [ <type> ] INTEGRATION (API, CATALOG, EXTERNAL ACCESS, NOTIFICATION, SECURITY, STORAGE): SET properties with parenthesized lists and key/value pairs, UNSET, TAG, and REFRESH of its secrets and keys. - ACCOUNT, current or named: properties, TAG, CONTACT, policies with FOR ALL ... and FORCE, RENAME TO [ SAVE_OLD_URL ], DROP OLD [ ORGANIZATION ] URL, and ADD/REMOVE ORGANIZATION USER GROUP. - ORGANIZATION: SET/UNSET properties and the event routing table, ORGANIZATION ACCOUNT, PROFILE, USER and USER GROUP. Organization-qualified account names refuse a reserved keyword as either part. Incomplete kinds, such as MASKING v1, DATA POLICY, FAILOVER v1, GROUP, PROFILE and EXTERNAL ACCESS v1, are syntax errors.
DROP of the Snowflake object kinds took any table reference as the name, so `DROP AGENT SELECT ;` parsed although Snowflake refuses it with errno 1003. The name now goes through the same object-name rule as ALTER: an identifier, never a string or an unquoted reserved keyword. A quoted `"SELECT"` is still a name.
…olicies # Conflicts: # crates/sqlquack-syntax/src/parser/_helpers/ddl/mod.rs
Contributor
Author
|
D94 gate for this PR:
|
Contributor
Author
|
Re-gate of the merge result (D94 remedy, D122d): main
|
kvlonge
added a commit
that referenced
this pull request
Nov 4, 2026
Basis: main deaa882 (PR #43), catalogue 97db46c, evidence a1c9e0f, parser tree a4401f7. - 81 newly approved forms (security_admin 47, ddl 34), read against their pinned pages and raw parser trees; M2 agrees on every case. - Not approved: alter-maintenance-policy.unset (catalogue: all-optional UNSET positive), and alter-connection.disable-failover plus alter-failover-group add/remove allowed accounts (parser: the <org>.<account> operand collapses into one unquoted name). - 8 earlier reviews are stale on re-rendered cases that still await receipts; drop-sequence stays withheld until PR #46. Checker at deaa882: valid, 3476 forms; 1384 of 3348 verified.
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.
Parses Snowflake
ALTERof policies and account-level objects into the typedAlterObjectstatement. Until now they went through the opaque Command fallback, which accepted their documented negatives. It also refuses an unquoted reserved keyword as a SnowflakeDROPobject name.BODY -> <expr>, AS bodies and ADD/REMOVE lists.ALTER SESSION POLICYno longer falls intoALTER SESSION, which is otherwise unchanged.parser/_helpers/ddl/snowflake_alter_account.rs. The policies extendsnowflake_alter_resources.rs.MASKING v1,DATA POLICY,FAILOVER v1,GROUP,PROFILE,EXTERNAL ACCESS v1.DROP AGENT SELECT ;and the same for every Snowflake DROP kind now fail as Snowflake does (errno 1003). The name follows ALTER's object-name rule;"SELECT"is still a name.tests/parser/test_snowflake_alter.rsandtest_fixes.rs.parse_account_listhelpers, so this PR's is renamedparse_account_names.Receipt harness: every form in the batch agrees with its receipts, except 6 cases in the ALTER USER [ GROUP ] path, which this PR doesn't touch. By group:
The only other mismatches are unscored observe rows.
Coverage diff:
family <f> --jsonfor all ten families. It compares the gate-profile checker of main 5581fa5 with this branch's (c12439e), over catalogue 3296ca1 plus evidence b56cd49:D122 floor: +84 forms against a floor of 67, so this PR gates on form count. The gain by kind:
Most of the remaining forms in these kinds already agree with every receipt, but still wait on observe rows or receipts.