Skip to content

Commit

Permalink
Fix drop table with keyword (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
w41ter committed May 10, 2024
1 parent ac617ba commit e81b0b7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/ccr/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -1004,7 +1004,7 @@ func (j *Job) handleDropTable(binlog *festruct.TBinlog) error {
tableName = srcTable.Name
}

sql := fmt.Sprintf("DROP TABLE %s FORCE", tableName)
sql := fmt.Sprintf("DROP TABLE %s FORCE", utils.FormatKeywordName(tableName))
log.Infof("dropTableSql: %s", sql)
if err = j.IDest.DbExec(sql); err != nil {
return err
Expand Down
12 changes: 12 additions & 0 deletions regression-test/suites/table-sync/test_keyword_name.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -167,4 +167,16 @@ suite("test_keyword_name") {
SHOW CREATE TABLE `TEST_${context.dbName}`.`${tableName}`
""",
checkNewPartition, 30, "target"))

logger.info("=== Test 3: Drop table ===")
sql "DROP TABLE `${tableName}`"

def notExist = { res -> Boolean
return res.size() == 0
}

assertTrue(checkShowTimesOf("""
SHOW CREATE TABLE `TEST_${context.dbName}`.`${tableName}`
""",
notExist, 30, "target"))
}

0 comments on commit e81b0b7

Please sign in to comment.