Support the MySQL database administration statements - #39
Merged
Conversation
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
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.
Implements the
mysql_unsupported_adminstatement coverage group (MySQL 26.7 §15.7): its error goldens turn intoRestore()goldens and the group is renamed tomysql_adminwith expanded coverage (15 → 38 cases), following themysql_compoundprecedent 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 TABLEwithFOR UPGRADE/QUICK/FAST/MEDIUM/EXTENDED/CHANGEDCHECKSUM TABLEwithQUICK/EXTENDEDREPAIR TABLEwithNO_WRITE_TO_BINLOG/LOCALandQUICK/EXTENDED/USE_FRMCREATE [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 onemysql_unsupported_ddlerror goldenINSTALL COMPONENT ... [SET ...](the SET clause reusesVariableAssignmentList),UNINSTALL COMPONENT,INSTALL PLUGIN ... SONAME,UNINSTALL PLUGINCLONE LOCAL DATA DIRECTORY [=] '...'andCLONE INSTANCE FROM 'user'@'host':port IDENTIFIED BY '...' [DATA DIRECTORY [=] '...'] [REQUIRE [NO] SSL]CACHE INDEXandLOAD INDEX INTO CACHE, sharing a table/partition/index spec node (partition lists,PARTITION (ALL),PRIMARYas an index name,IN default,IGNORE LEAVES)RESET PERSIST [[IF EXISTS] var]— the other RESET forms deliberately keep failing at the RESET token, so themysql_unsupported_replicationgoldens are byte-identicalTYPE,VCPU,THREAD_PRIORITY, andENABLE/DISABLE [FORCE]join the TiDB dialect options inDirectResourceGroupOptionAST (backwards-compatible additions only)
New nodes in
ast/admin.go:CheckTableStmt,ChecksumTableStmt,RepairTablesStmt(named to avoid the existing ADMIN REPAIR TABLERepairTableStmt),CreateLoadableFunctionStmt,InstallComponentStmt,UninstallComponentStmt,InstallPluginStmt,UninstallPluginStmt,CloneStmt,CacheIndexStmt,LoadIndexStmt,ResetPersistStmt, and the sharedCacheTableIndexspec, plus SEMCommand strings inast/sem.go.ResourceGroupOptiongains newResourceUnitTypevalues andIntValue/BoolValue/Forcefields.CloneStmtimplementsSecureText()to mask the donor password, followingChangeReplicationSourceStmt.Keyword tables
AGGREGATE,CHANGED,CLONE,COMPONENT,FAST,INSTALL,LEAVES,PERSIST,PLUGIN,RETURNS,SONAME,STRING,THREAD_PRIORITY,UNINSTALL,UPGRADE,USE_FRM, andVCPUbecome unreserved keywords, matching their MySQL 26.7 classification;TestKeywordsLengthcounts updated (690 → 707, reserved count unchanged).Testing
go test ./... -count=1 -timeout 120spasses; gofmt andgo vetclean.testdata/errors.jsonis unaffected — none of its cases start with these statement heads, soTestRDErrorFidelitystill validates the goyacc-recorded messages unchanged.🤖 Generated with Claude Code
https://claude.ai/code/session_019LZBMHBjSguS9x9o5phhP4
Generated by Claude Code