diff --git a/canal/canal.go b/canal/canal.go index d18a570cc..5fc7c0733 100644 --- a/canal/canal.go +++ b/canal/canal.go @@ -436,7 +436,7 @@ func (c *Canal) checkBinlogRowFormat() error { func isSafeIdentifier(s string) bool { for _, r := range s { - if !(unicode.IsLetter(r) || unicode.IsDigit(r) || r == '_' || r == '-') { + if !(unicode.IsLetter(r) || unicode.IsDigit(r) || r == '_' || r == '-' || r == ' ') { return false } } diff --git a/canal/canal_test.go b/canal/canal_test.go index 1e5e12672..46bb192b3 100644 --- a/canal/canal_test.go +++ b/canal/canal_test.go @@ -508,8 +508,10 @@ func TestIsSafeIdentifier(t *testing.T) { {"unicode letters", "tàble", true}, {"chinese characters", "表格", true}, + // Space is valid (MySQL allows spaces in identifiers when quoted) + {"space", "my table", true}, + // Invalid identifiers - {"space", "my table", false}, {"dot", "my.table", false}, {"at symbol", "@table", false}, {"hash symbol", "#table", false},