feat(dsql): parse ALTER TABLE ASYNC#2
Open
agarwal-govind wants to merge 1 commit into
Open
Conversation
Aurora DSQL runs certain ALTER TABLE operations as asynchronous DDL jobs via the ALTER TABLE ASYNC form, e.g. ALTER TABLE ASYNC t VALIDATE CONSTRAINT c which returns a job_id and validates existing rows in the background (same async DDL model as CREATE INDEX ASYNC). Add an `async` flag to the AlterTable AST node, parse an optional ASYNC keyword immediately after TABLE (before IF EXISTS / ONLY), and render it in Display. Non-async ALTER TABLE is unchanged. - ast/ddl.rs: AlterTable.async field + Display - parser/mod.rs: parse_alter_table parses optional ASYNC - dialect/snowflake.rs: set async: false at the two AlterTable sites - tests/sqlparser_postgres.rs: async VALIDATE CONSTRAINT round-trip, incl. ASYNC + IF EXISTS + ONLY Exact round-trip verified; full postgres (180) and common (471) suites pass.
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.
Summary
Aurora DSQL runs certain
ALTER TABLEoperations as asynchronous DDL jobs via theALTER TABLE ASYNCform — most notably:which returns a
job_idand validates existing rows in the background (the same async DDL model asCREATE INDEX ASYNC, already supported on this branch). The parser currently rejectsALTER TABLE ASYNC ...becauseASYNCis not recognized afterTABLE.This adds an
asyncflag to theAlterTableAST node and parses the optionalASYNCkeyword, following the existingCREATE INDEX ASYNCprecedent.Changes
ast/ddl.rs: addAlterTable.async: bool+ renderASYNCinDisplay(afterALTER TABLE, beforeIF EXISTS/ONLY).parser/mod.rs:parse_alter_tableparses an optionalASYNCkeyword. Non-asyncALTER TABLEis unchanged.dialect/snowflake.rs: setasync: falseat the twoAlterTableconstruction sites.tests/sqlparser_postgres.rs: round-trip tests forALTER TABLE ASYNC ... VALIDATE CONSTRAINT, includingASYNC+IF EXISTS+ONLY.Cargo.toml: bumpsqlparser-dsql0.62.1→0.62.2and noteALTER TABLE ASYNCin the description.Testing
ALTER TABLE ASYNC t VALIDATE CONSTRAINT candALTER TABLE ASYNC IF EXISTS ONLY public.t VALIDATE CONSTRAINT c.sqlparser_postgres(180) andsqlparser_common(471).Why
Unblocks
dsql-lint(awslabs/aurora-dsql-tools) from upgrading itsVALIDATE CONSTRAINTrule from "guide to ASYNC" to full auto-fix + clean-pass of the validALTER TABLE ASYNCform, matching howCREATE INDEX ASYNCis handled. Part of the DSQLVALIDATE CONSTRAINT ASYNCecosystem rollout (agent-plugins, mcp, aurora-dsql-orms, aurora-dsql-tools).By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the project license.