fix: validate --alter rejects trailing semicolon - #1744
Open
drkemp187 wants to merge 1 commit into
Open
Conversation
Reject --alter values that end with ';' so --attempt-instant-ddl does not append ALGORITHM=INSTANT after the terminator (and avoid related DDL footguns). Prefer options-only form; warn when a full ALTER TABLE prefix is used. Document the rule in command-line-flags.md. Fixes github#1431
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
--altervalues that end with a semicolon (;).--alteruses a fullALTER TABLE ...prefix (options-only form preferred).doc/command-line-flags.md.Why
Trailing
;breaks--attempt-instant-ddlbecauseALGORITHM=INSTANTis appended after the terminator. Full-statement pastes that include a trailing semicolon have also been implicated in empty/broken indexes (see discussion on #1431).Full
ALTER TABLE [db.]table ...form remains accepted so schema/table can still be discovered from--alter.Closes #1431
Test plan
go test ./go/sql/(parser package)gh-ost ... --alter='ADD COLUMN x INT;'should fatal with clear messagegh-ost ... --alter='ADD COLUMN x INT'still acceptedRelated tooling: publishguard · evadelint