mssql: pin CREATE OR ALTER PROCEDURE splitting after a statement without GO - #409
Merged
Merged
Conversation
…out GO Regression test for BYT-10207. A customer on Bytebase 3.14.0 got a "Syntax error at line 98:20" from bytebase-action check on a migration whose CREATE OR ALTER PROCEDURE followed an ALTER TABLE with no GO between them. The legacy ANTLR splitter treated the ';' terminators inside the procedure body as statement boundaries, cut the procedure into fragments, and each fragment then failed to parse on its own. The omni parser (shipped in 3.17.1) never had the defect, but nothing guarded the behaviour. The fixture mirrors the customer's file: an optional preceding statement with or without GO, Spanish accented comments, and a procedure body full of ';', padded so SET NOCOUNT ON; lands on line 98. For each of the three shapes the test asserts the exact statement sequence by AST type, that the procedure starts at its CREATE keyword, and that its Text runs unbroken from CREATE through the final END;. go vet ./mssql and go test ./mssql pass. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
Regression test for BYT-10207.
A customer on Bytebase 3.14.0 hit
Syntax error at line 98:20frombytebase-action checkon a migration whoseCREATE OR ALTER PROCEDUREfollowed anALTER TABLEwith noGObetween them. The legacy ANTLR splitter treated the;terminators inside the procedure body as statement boundaries, cut the procedure into fragments, and each fragment then failed to parse standalone. The omni parser, shipped in 3.17.1, never had the defect, but nothing guarded the behaviour. The issue asked for a test to pin it.The fixture mirrors the customer's file: an optional preceding statement with or without
GO, Spanish accented comments, and a procedure body full of;, padded soSET NOCOUNT ON;lands on line 98. For each of the three shapes the test asserts the exact statement sequence by AST type, that the procedure starts at itsCREATEkeyword, and that itsTextruns unbroken fromCREATEthrough the finalEND;.Verified against bytebase
origin/main(47a923697c) throughbase.ParseStatementsas well: the no-GOshape yields two clean statements.go vet ./mssqlandgo test ./mssqlpass.🤖 Generated with Claude Code