Issue with Hyphen "-" in Lightning Restore Database Error

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: lightning恢复库报错中横线"-"问题

| username: TiDBer_嘎嘣脆

[TiDB Usage Environment] Production Environment
[TiDB Version] 6.5.0
[Reproduction Path] None
[Encountered Problem: Problem Phenomenon and Impact]
tidb lightning encountered error: [Lightning:Config:ErrInvalidConfig] parse filter failed: at :1: unexpected special character ‘-’
The database name contains “-”, not an underscore, so restoring the backup data results in an error.
[Resource Configuration] Go to TiDB Dashboard - Cluster Info - Hosts and take a screenshot of this page
[Attachment: Screenshot/Log/Monitoring]

| username: TiDBer_嘎嘣脆 | Original post link

Currently, the database name cannot be changed.

| username: tidb狂热爱好者 | Original post link

Database rename wake-up

| username: tidb狂热爱好者 | Original post link

Either wrap the name with ‘m’.

| username: Soysauce520 | Original post link

Will it still report an error if you put it in quotes?

| username: Jiawei | Original post link

Find the corresponding file and modify the create statement inside, import it first, and then rename it at the end?

| username: 小龙虾爱大龙虾 | Original post link

You made a mistake when parsing the toml configuration file, right? Check if it meets the toml format requirements, refer to: GitHub - toml-lang/toml: Tom's Obvious, Minimal Language

| username: redgame | Original post link

Use quotation marks to enclose the database name.

| username: 小于同学 | Original post link

Use quotation marks to enclose the database name.

| username: 考试没答案 | Original post link

Pay attention to the version issue: I remember during testing, try to use the latest version. Both the DM tool and the TiDB version need to be consistent to avoid this error. I also encountered this error when using different versions.

| username: Kongdom | Original post link

:thinking: I also think it’s better to wrap it with tidb-test, note that it’s not single quotes.

| username: TiDBer_5cwU0ltE | Original post link

Is this considered a BUG? It seems like there are other ways to bypass this.

| username: WalterWj | Original post link

If the backed-up table structure is not enclosed in ``, it is likely caused by the sql-mode. Check the sql-mode of the upstream MySQL.

| username: zhang_2023 | Original post link

Just escape it.