Skip to content

fix: validate --alter rejects trailing semicolon - #1744

Open
drkemp187 wants to merge 1 commit into
github:masterfrom
drkemp187:fix/alter-validation-1431
Open

fix: validate --alter rejects trailing semicolon#1744
drkemp187 wants to merge 1 commit into
github:masterfrom
drkemp187:fix/alter-validation-1431

Conversation

@drkemp187

Copy link
Copy Markdown

Summary

  • Reject --alter values that end with a semicolon (;).
  • Warn when --alter uses a full ALTER TABLE ... prefix (options-only form preferred).
  • Document the validation in doc/command-line-flags.md.

Why

Trailing ; breaks --attempt-instant-ddl because ALGORITHM=INSTANT is 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)
  • Manual: gh-ost ... --alter='ADD COLUMN x INT;' should fatal with clear message
  • Manual: gh-ost ... --alter='ADD COLUMN x INT' still accepted

Related tooling: publishguard · evadelint

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Suggestion] Apply simple validation to alter command

1 participant