Skip to content

feat(parser): structure MySQL DROP INDEX ... ON table (incl. db-qualified target) - #61

Merged
sjincho merged 1 commit into
mainfrom
sjcho/parser/drop-index-on
Aug 4, 2026
Merged

feat(parser): structure MySQL DROP INDEX ... ON table (incl. db-qualified target)#61
sjincho merged 1 commit into
mainfrom
sjcho/parser/drop-index-on

Conversation

@sjincho

@sjincho sjincho commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

MySQL DROP INDEX idx ON tbl degraded to a raw Command (the port had no exp.OnProperty node for the ON-clause target), so the proxy-monster analyzer over-denied a legitimate table-DDL statement. This adds the OnProperty node and parses the ON target as a table:

  • DROP INDEX idx ON usersDrop{kind:INDEX, this:Table(idx), cluster:OnProperty(Table(users))}
  • DROP INDEX idx ON db.users… cluster:OnProperty(Table(users, schema:db))

Two behaviors, one entry (DEVIATIONS §1.16):

  • The unqualified form is a port completion — pinned upstream v30.12.0 already structures it as Drop{cluster:OnProperty}; the port just lacked the node.
  • The db-qualified form is a correctness divergence: upstream's shared _parse_on_property parses only a single id, so it parse-errors ON db.users at the dot — but real MySQL 8.0.46 accepts it (verified: DROP INDEX idx_email ON zzq.users executes). Parsing a full table target matches the DB and preserves the qualifier for the consumer's grant. Registered in testdata/upstream_extensions.jsonl (mysql-drop-index-on-qualified) with a tripwire.

Trap: the fix is scoped to parseDrop — the shared parseOnProperty is left unchanged (its ON <id>OnProperty half is the ClickHouse ON CLUSTER form, out of this port's base+MySQL+Postgres scope), so CREATE/ALTER are untouched. The OnProperty target is a Table (not upstream's bare Identifier) so it can carry the db qualifier — an output-identical AST-shape difference for the unqualified form.

Verification: go test ./... green; mysql identity corpus 424→425; oracle-checked on MySQL 8.0.46. Reviewed by Codex + Sol (Grok's leg aborted on upstream API instability); Codex caught the db-qualified case, now fixed.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Bi9bXQhVpzEYuHoZrie9NF

…fied target)

MySQL `DROP INDEX idx ON tbl` degraded to a raw Command because the port had no
exp.OnProperty node for the ON-clause target, so parseDrop's ON branch fell back
to Command. This adds the OnProperty node and parses the ON target as a table:

  DROP INDEX idx ON users      -> Drop{kind:INDEX, this:Table(idx), cluster:OnProperty(Table(users))}
  DROP INDEX idx ON db.users   -> ... cluster:OnProperty(Table(users, schema:db))

Pinned upstream v30.12.0 structures the unqualified form (this closes that port
gap), but its shared _parse_on_property parses only a single id, so it parse-errors
the db-qualified `ON db.users` — which real MySQL 8.0.46 accepts. Parsing a full
table target here (scoped to DROP; CREATE/ALTER keep upstream's ON handling) matches
the DB and preserves the qualifier for the consumer's INDEX-DDL grant. The qualified
form is registered in testdata/upstream_extensions.jsonl with a tripwire; see
DEVIATIONS §1.16.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Bi9bXQhVpzEYuHoZrie9NF
@sjincho
sjincho merged commit f875948 into main Aug 4, 2026
4 checks passed
@sjincho
sjincho deleted the sjcho/parser/drop-index-on branch August 4, 2026 11:31
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.

1 participant