From e05ce0724f076040c592533f5cc04f372cece0b4 Mon Sep 17 00:00:00 2001 From: Kevin Biju <52661649+heavycrystal@users.noreply.github.com> Date: Sat, 9 Nov 2024 04:26:17 +0530 Subject: [PATCH] quote table names for drop,fallback rename (#2235) --- flow/connectors/clickhouse/cdc.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flow/connectors/clickhouse/cdc.go b/flow/connectors/clickhouse/cdc.go index 4792321ae..97b51a490 100644 --- a/flow/connectors/clickhouse/cdc.go +++ b/flow/connectors/clickhouse/cdc.go @@ -20,7 +20,7 @@ import ( const ( checkIfTableExistsSQL = `SELECT exists(SELECT 1 FROM system.tables WHERE database = ? AND name = ?) AS table_exists;` - dropTableIfExistsSQL = `DROP TABLE IF EXISTS %s;` + dropTableIfExistsSQL = "DROP TABLE IF EXISTS `%s`;" ) // getRawTableName returns the raw table name for the given table identifier. @@ -215,7 +215,7 @@ func (c *ClickHouseConnector) RenameTables( } if err := c.execWithLogging(ctx, - fmt.Sprintf("RENAME TABLE %s TO %s", renameRequest.CurrentName, renameRequest.NewName), + fmt.Sprintf("RENAME TABLE `%s` TO `%s`", renameRequest.CurrentName, renameRequest.NewName), ); err != nil { return nil, fmt.Errorf("unable to rename table %s to %s: %w", renameRequest.CurrentName, renameRequest.NewName, err) }