diff --git a/pkg/backup/table_pattern.go b/pkg/backup/table_pattern.go index c0ad700a..b2e66d31 100644 --- a/pkg/backup/table_pattern.go +++ b/pkg/backup/table_pattern.go @@ -337,9 +337,6 @@ func changeTableQueryToAdjustDatabaseMapping(originTables *ListOfTables, dbMapRu underlyingDB := matches[0][3] underlyingDBClean := strings.NewReplacer(" ", "", "'", "").Replace(underlyingDB) if underlyingTargetDB, isUnderlyingMapped := dbMapRule[underlyingDBClean]; isUnderlyingMapped { - if !usualIdentifier.MatchString(underlyingTargetDB) { - underlyingTargetDB = "`" + underlyingTargetDB + "`" - } substitution = fmt.Sprintf("${1}(${2},%s,${4})", strings.Replace(underlyingDB, underlyingDBClean, underlyingTargetDB, 1)) originTable.Query = distributedRE.ReplaceAllString(originTable.Query, substitution) } diff --git a/test/integration/integration_test.go b/test/integration/integration_test.go index dc8d536f..e7059309 100644 --- a/test/integration/integration_test.go +++ b/test/integration/integration_test.go @@ -1775,7 +1775,7 @@ func TestRestoreDatabaseMapping(t *testing.T) { ch.queryWithNoError(r, "CREATE DATABASE database1") ch.queryWithNoError(r, "CREATE TABLE database1.t1 (dt DateTime, v UInt64) ENGINE=ReplicatedMergeTree('/clickhouse/tables/database1/t1','{replica}') PARTITION BY toYYYYMM(dt) ORDER BY dt") - ch.queryWithNoError(r, "CREATE TABLE database1.d1 AS database1.t1 ENGINE=Distributed('{cluster}',database1, t1)") + ch.queryWithNoError(r, "CREATE TABLE database1.d1 AS database1.t1 ENGINE=Distributed('{cluster}', 'database1', 't1')") if compareVersion(os.Getenv("CLICKHOUSE_VERSION"), "22.3") < 0 { ch.queryWithNoError(r, "CREATE TABLE database1.t2 AS database1.t1 ENGINE=ReplicatedMergeTree('/clickhouse/tables/database1/t2','{replica}') PARTITION BY toYYYYMM(dt) ORDER BY dt") } else {