From a1f05073eb789702c80c7839fefbe7d396373e46 Mon Sep 17 00:00:00 2001 From: dnovitski <54758025+dnovitski@users.noreply.github.com> Date: Sun, 24 May 2026 01:42:19 +0200 Subject: [PATCH] Fix MySQL compatibility: EscapeName backticks, REPLICATION REPLICA - Escape embedded backticks in EscapeName by doubling them, preventing broken SQL identifiers (builder.go) - Accept REPLICATION REPLICA privilege in grant check for MySQL 8.4+ compatibility, where REPLICATION SLAVE was renamed (inspect.go) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- go/logic/inspect.go | 3 +++ go/sql/builder.go | 1 + 2 files changed, 4 insertions(+) diff --git a/go/logic/inspect.go b/go/logic/inspect.go index 96aadd672..904c247c1 100644 --- a/go/logic/inspect.go +++ b/go/logic/inspect.go @@ -249,6 +249,9 @@ func (isp *Inspector) validateGrants() error { if strings.Contains(grant, `REPLICATION SLAVE`) && strings.Contains(grant, ` ON *.*`) { foundReplicationSlave = true } + if strings.Contains(grant, `REPLICATION REPLICA`) && strings.Contains(grant, ` ON *.*`) { + foundReplicationSlave = true + } if strings.Contains(grant, fmt.Sprintf("GRANT ALL PRIVILEGES ON `%s`.*", isp.migrationContext.DatabaseName)) { foundDBAll = true } diff --git a/go/sql/builder.go b/go/sql/builder.go index 6e41eb4e1..764f33fd3 100644 --- a/go/sql/builder.go +++ b/go/sql/builder.go @@ -30,6 +30,7 @@ func EscapeName(name string) string { if unquoted, err := strconv.Unquote(name); err == nil { name = unquoted } + name = strings.ReplaceAll(name, "`", "``") return fmt.Sprintf("`%s`", name) }