@@ -261,7 +261,7 @@ func (c *ClickHouseConnector) ReplayTableSchemaDeltas(
261261 var shardTableName string
262262 if c .Config .Cluster != "" && (tm == nil || tm .Engine != protos .TableEngine_CH_ENGINE_NULL ) {
263263 var err error
264- shardTableName , err = c .getDistributedShardTable (ctx , dstTable .Table )
264+ shardTableName , err = c .getDistributedShardTable (ctx , dstTable .LegacyDotted () )
265265 if err != nil {
266266 return fmt .Errorf ("failed to resolve shard table for %s: %w" , dstTable , err )
267267 }
@@ -288,7 +288,7 @@ func (c *ClickHouseConnector) ReplayTableSchemaDeltas(
288288
289289 if err := c .execWithLogging (ctx ,
290290 fmt .Sprintf ("ALTER TABLE %s%s ADD COLUMN IF NOT EXISTS %s %s" ,
291- peerdb_clickhouse .QuoteIdentifier (dstTable .Table ), onCluster ,
291+ peerdb_clickhouse .QuoteIdentifier (dstTable .LegacyDotted () ), onCluster ,
292292 peerdb_clickhouse .QuoteIdentifier (addedColumn .Name ), clickHouseColType ),
293293 ); err != nil {
294294 return fmt .Errorf ("failed to add column %s for table %s: %w" , addedColumn .Name , dstTable , err )
@@ -321,7 +321,7 @@ func (c *ClickHouseConnector) RenameTables(
321321 continue
322322 }
323323
324- resyncTableExists , err := c .checkIfTableExists (ctx , c .Config .Database , currentTable .Table )
324+ resyncTableExists , err := c .checkIfTableExists (ctx , c .Config .Database , currentTable .LegacyDotted () )
325325 if err != nil {
326326 return nil , fmt .Errorf ("unable to check if resync table %s exists: %w" , currentTable , err )
327327 }
@@ -331,7 +331,7 @@ func (c *ClickHouseConnector) RenameTables(
331331 continue
332332 }
333333
334- originalTableExists , err := c .checkIfTableExists (ctx , c .Config .Database , newTable .Table )
334+ originalTableExists , err := c .checkIfTableExists (ctx , c .Config .Database , newTable .LegacyDotted () )
335335 if err != nil {
336336 return nil , fmt .Errorf ("unable to check if table %s exists: %w" , newTable , err )
337337 }
@@ -342,11 +342,11 @@ func (c *ClickHouseConnector) RenameTables(
342342 c .logger .Info ("attempting atomic exchange" ,
343343 slog .String ("OldName" , currentTable .String ()), slog .String ("NewName" , newTable .String ()))
344344 if err = c .execWithLogging (ctx ,
345- fmt .Sprintf ("EXCHANGE TABLES %s and %s%s" , peerdb_clickhouse .QuoteIdentifier (newTable .Table ),
346- peerdb_clickhouse .QuoteIdentifier (currentTable .Table ), onCluster ),
345+ fmt .Sprintf ("EXCHANGE TABLES %s and %s%s" , peerdb_clickhouse .QuoteIdentifier (newTable .LegacyDotted () ),
346+ peerdb_clickhouse .QuoteIdentifier (currentTable .LegacyDotted () ), onCluster ),
347347 ); err == nil {
348348 if err := c .execWithLogging (ctx ,
349- fmt .Sprintf (dropTableSQLWithCHSetting , peerdb_clickhouse .QuoteIdentifier (currentTable .Table ), onCluster ),
349+ fmt .Sprintf (dropTableSQLWithCHSetting , peerdb_clickhouse .QuoteIdentifier (currentTable .LegacyDotted () ), onCluster ),
350350 ); err != nil {
351351 return nil , fmt .Errorf ("unable to drop exchanged table %s: %w" , currentTable , err )
352352 }
@@ -361,14 +361,14 @@ func (c *ClickHouseConnector) RenameTables(
361361 // or err is set (in which case err comes from EXCHANGE TABLES)
362362 if ! originalTableExists || err != nil {
363363 if err := c .execWithLogging (ctx ,
364- fmt .Sprintf (dropTableSQLWithCHSetting , peerdb_clickhouse .QuoteIdentifier (newTable .Table ), onCluster ),
364+ fmt .Sprintf (dropTableSQLWithCHSetting , peerdb_clickhouse .QuoteIdentifier (newTable .LegacyDotted () ), onCluster ),
365365 ); err != nil {
366366 return nil , fmt .Errorf ("unable to drop table %s: %w" , newTable , err )
367367 }
368368
369369 if err := c .execWithLogging (ctx , fmt .Sprintf ("RENAME TABLE %s TO %s%s" ,
370- peerdb_clickhouse .QuoteIdentifier (currentTable .Table ),
371- peerdb_clickhouse .QuoteIdentifier (newTable .Table ), onCluster ,
370+ peerdb_clickhouse .QuoteIdentifier (currentTable .LegacyDotted () ),
371+ peerdb_clickhouse .QuoteIdentifier (newTable .LegacyDotted () ), onCluster ,
372372 )); err != nil {
373373 return nil , fmt .Errorf ("unable to rename table %s to %s: %w" , currentTable , newTable , err )
374374 }
0 commit comments