Skip to content

Support the MySQL database administration statements - #39

Merged
kyleconroy merged 1 commit into
mainfrom
claude/mysql-unsupported-admin-testdata-7hyrpo
Aug 18, 2026
Merged

Support the MySQL database administration statements#39
kyleconroy merged 1 commit into
mainfrom
claude/mysql-unsupported-admin-testdata-7hyrpo

Conversation

@kyleconroy

Copy link
Copy Markdown
Contributor

Implements the mysql_unsupported_admin statement coverage group (MySQL 26.7 §15.7): its error goldens turn into Restore() goldens and the group is renamed to mysql_admin with expanded coverage (15 → 38 cases), following the mysql_compound precedent from #38.

Parser (parser/parse_mysql_admin.go, new)

Grammar written from the MySQL 26.7 reference manual, since these statements postdate the goyacc grammar:

  • CHECK TABLE with FOR UPGRADE / QUICK / FAST / MEDIUM / EXTENDED / CHANGED
  • CHECKSUM TABLE with QUICK / EXTENDED
  • REPAIR TABLE with NO_WRITE_TO_BINLOG / LOCAL and QUICK / EXTENDED / USE_FRM
  • CREATE [AGGREGATE] FUNCTION [IF NOT EXISTS] ... RETURNS {STRING|INTEGER|INT|REAL|DECIMAL} SONAME '...' — the loadable function form only, hooked into the CREATE dispatch; stored functions still fail, now at their parameter list, which moves one mysql_unsupported_ddl error golden
  • INSTALL COMPONENT ... [SET ...] (the SET clause reuses VariableAssignmentList), UNINSTALL COMPONENT, INSTALL PLUGIN ... SONAME, UNINSTALL PLUGIN
  • CLONE LOCAL DATA DIRECTORY [=] '...' and CLONE INSTANCE FROM 'user'@'host':port IDENTIFIED BY '...' [DATA DIRECTORY [=] '...'] [REQUIRE [NO] SSL]
  • CACHE INDEX and LOAD INDEX INTO CACHE, sharing a table/partition/index spec node (partition lists, PARTITION (ALL), PRIMARY as an index name, IN default, IGNORE LEAVES)
  • RESET PERSIST [[IF EXISTS] var] — the other RESET forms deliberately keep failing at the RESET token, so the mysql_unsupported_replication goldens are byte-identical
  • The MySQL-syntax resource group options TYPE, VCPU, THREAD_PRIORITY, and ENABLE/DISABLE [FORCE] join the TiDB dialect options in DirectResourceGroupOption

AST (backwards-compatible additions only)

New nodes in ast/admin.go: CheckTableStmt, ChecksumTableStmt, RepairTablesStmt (named to avoid the existing ADMIN REPAIR TABLE RepairTableStmt), CreateLoadableFunctionStmt, InstallComponentStmt, UninstallComponentStmt, InstallPluginStmt, UninstallPluginStmt, CloneStmt, CacheIndexStmt, LoadIndexStmt, ResetPersistStmt, and the shared CacheTableIndex spec, plus SEMCommand strings in ast/sem.go. ResourceGroupOption gains new ResourceUnitType values and IntValue/BoolValue/Force fields. CloneStmt implements SecureText() to mask the donor password, following ChangeReplicationSourceStmt.

Keyword tables

AGGREGATE, CHANGED, CLONE, COMPONENT, FAST, INSTALL, LEAVES, PERSIST, PLUGIN, RETURNS, SONAME, STRING, THREAD_PRIORITY, UNINSTALL, UPGRADE, USE_FRM, and VCPU become unreserved keywords, matching their MySQL 26.7 classification; TestKeywordsLength counts updated (690 → 707, reserved count unchanged).

Testing

  • go test ./... -count=1 -timeout 120s passes; gofmt and go vet clean.
  • Every new case round-trips (restore output re-parses to a deep-equal AST) via the file-driven suite.
  • testdata/errors.json is unaffected — none of its cases start with these statement heads, so TestRDErrorFidelity still validates the goyacc-recorded messages unchanged.

🤖 Generated with Claude Code

https://claude.ai/code/session_019LZBMHBjSguS9x9o5phhP4


Generated by Claude Code

Implement the mysql_unsupported_admin statement coverage group (MySQL
26.7 §15.7): its error goldens turn into Restore() goldens and the group
is renamed to mysql_admin with expanded coverage, following the
mysql_compound precedent.

Grammar, written from the reference manual since these statements
postdate the goyacc grammar (parser/parse_mysql_admin.go):

- CHECK TABLE with FOR UPGRADE/QUICK/FAST/MEDIUM/EXTENDED/CHANGED,
  CHECKSUM TABLE with QUICK/EXTENDED, and REPAIR TABLE with
  NO_WRITE_TO_BINLOG/LOCAL and QUICK/EXTENDED/USE_FRM
- CREATE [AGGREGATE] FUNCTION [IF NOT EXISTS] ... RETURNS ... SONAME,
  the loadable function form only; stored functions still fail, now at
  their parameter list, which moves one mysql_unsupported_ddl error
  golden
- INSTALL/UNINSTALL COMPONENT (INSTALL's SET clause reuses
  VariableAssignmentList) and INSTALL/UNINSTALL PLUGIN
- CLONE LOCAL and CLONE INSTANCE FROM; CloneStmt implements SecureText
  to mask the donor password
- CACHE INDEX and LOAD INDEX INTO CACHE, sharing the CacheTableIndex
  table/partition/index spec node
- RESET PERSIST [[IF EXISTS] var]; the other RESET forms keep failing
  at the statement head, so their error goldens are unchanged
- The MySQL-syntax resource group options TYPE, VCPU, THREAD_PRIORITY,
  and ENABLE/DISABLE [FORCE] join the TiDB dialect options in
  DirectResourceGroupOption (new ResourceUnitType values and new
  IntValue/BoolValue/Force fields on ResourceGroupOption)

New AST nodes (ast/admin.go): CheckTableStmt, ChecksumTableStmt,
RepairTablesStmt (RepairTableStmt is the unrelated ADMIN REPAIR TABLE
node), CreateLoadableFunctionStmt, InstallComponentStmt,
UninstallComponentStmt, InstallPluginStmt, UninstallPluginStmt,
CloneStmt, CacheIndexStmt, LoadIndexStmt, and ResetPersistStmt, plus
their SEMCommand strings.

Keyword tables: AGGREGATE, CHANGED, CLONE, COMPONENT, FAST, INSTALL,
LEAVES, PERSIST, PLUGIN, RETURNS, SONAME, STRING, THREAD_PRIORITY,
UNINSTALL, UPGRADE, USE_FRM, and VCPU become unreserved keywords,
matching their MySQL 26.7 classification; TestKeywordsLength counts
updated accordingly. testdata/errors.json is unaffected.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019LZBMHBjSguS9x9o5phhP4
@kyleconroy
kyleconroy merged commit aa811ff into main Aug 18, 2026
1 check passed
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.

2 participants