Align keyword tables with MySQL 26.7 and support CHANGE REPLICATION SOURCE TO - #36
Merged
Merged
Conversation
MySQL 26.7.0 corrected the classification of six keywords (MySQL Bug #114874): CUBE, EXTERNAL, QUALIFY, and TABLESAMPLE are reserved words (the server has rejected them as unquoted identifiers since 8.4), while MANUAL and PARALLEL are non-reserved keywords. marino previously treated all of them except TABLESAMPLE as plain identifiers. Reserve CUBE, EXTERNAL, and QUALIFY - they remain usable quoted or after a qualifying dot, matching MySQL - and register MANUAL and PARALLEL as unreserved keywords, which keep working in identifier position. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019Jbktm7oVU7ysVz4MdS9D7
The ast package is no longer frozen outright: new node types and new fields are allowed. Existing nodes, fields, and their semantics remain part of the contract with sqlc's MySQL engine and must not change. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019Jbktm7oVU7ysVz4MdS9D7
Add ChangeReplicationSourceStmt, the first additive ast change under the relaxed backwards-compatibility rule. The statement parses a generic name = literal option list plus the FOR CHANNEL clause, so the MySQL 26.7 Change Stream Applier options (APPLIER_VERSION, APPLIER_WORKER_COUNT, APPLIER_EVENT_MEMORY_LIMIT) parse like the connection options; option names are not validated against the server's list. SecureText masks PASSWORD-carrying options. CHANNEL joins the keyword tables as a non-reserved keyword, matching MySQL. The removed CHANGE MASTER TO spelling stays unsupported, matching MySQL 8.4+. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019Jbktm7oVU7ysVz4MdS9D7
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.
Reviewing the MySQL 26.7.0 changelog (the first calendar-versioned release, 2026-07-28) surfaced two parser-relevant items; this PR implements both, plus the policy change that unblocks the second.
Keyword reservation (
22d71fd)MySQL 26.7 corrected
information_schema.KEYWORDS(Bug #114874): the server has rejectedCUBE,EXTERNAL,QUALIFY, andTABLESAMPLEas unquoted identifiers since 8.4, whileMANUALandPARALLELare non-reserved. marino had onlyTABLESAMPLE; the rest lexed as plain identifiers.CUBE,EXTERNAL,QUALIFYare now reserved: rejected as unquoted identifiers, still valid backquoted or after a qualifying dot (SELECT t.cube FROM t), matching MySQL.MANUALandPARALLELjoin the unreserved keyword class and keep working in identifier position.Breaking change: SQL that used
cube,external, orqualifyas unquoted identifiers no longer parses. That is the cost of matching MySQL 8.4+/26.7.ast policy (
adb7755)CLAUDE.md previously declared the
astpackage frozen (a rewrite-era rule from PLAN.md, where it kept oracle and HEAD dumps comparable). It now permits backwards-compatible evolution: new node types and fields are allowed; existing nodes, fields, and semantics remain part of the contract with sqlc's MySQL engine.CHANGE REPLICATION SOURCE TO (
8385d39)26.7 adds three Change Stream Applier options (
APPLIER_VERSION,APPLIER_WORKER_COUNT,APPLIER_EVENT_MEMORY_LIMIT) toCHANGE REPLICATION SOURCE TO, which marino did not parse at all. New additive support:ast.ChangeReplicationSourceStmtwith a genericNAME = literaloption list andFOR CHANNELclause. Option names are uppercased but not validated against the server's option list, so the 26.7 applier options parse like the connection options and future additions need no parser change. ImplementsSensitiveStmtNode;SecureText()masks options whose name containsPASSWORD.parser/parse_replication.goregistersCHANGEas a statement leader. The production comment cites the MySQL 26.7 manual since the statement postdates the goyacc grammar. The removedCHANGE MASTER TOspelling stays a syntax error, matching MySQL 8.4+.CHANNELadded as a non-reserved keyword (MySQL's classification).ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS = OFF) and list-valued ones (IGNORE_SERVER_IDS = (...)) would need small extensions.Testing
TestMySQLReservedWordCompatandTestChangeReplicationSourcecover reservation semantics, the applier options, restore round-trips, negative cases, and password masking;TestSimplelists gained the six new words.TestKeywordConsistentkeeps the four hand-maintained keyword tables in agreement, andTestKeywordsLengthcounts are updated (679→685 total, 233→236 reserved). Fullgo test ./... -count=1 -timeout 120sis green;TestRDErrorFidelitygoldens unchanged.🤖 Generated with Claude Code
https://claude.ai/code/session_019Jbktm7oVU7ysVz4MdS9D7
Generated by Claude Code