You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "lvyanquan (via GitHub)" <gi...@apache.org> on 2025/08/04 02:21:27 UTC

Re: [PR] [minor] Fix potential sql connection statement issue [flink-cdc]

lvyanquan commented on code in PR #4069:
URL: https://github.com/apache/flink-cdc/pull/4069#discussion_r2250273555


##########
flink-cdc-connect/flink-cdc-source-connectors/flink-connector-mysql-cdc/src/main/java/org/apache/flink/cdc/connectors/mysql/source/utils/StatementUtils.java:
##########
@@ -225,7 +225,7 @@ public static PreparedStatement readTableSplitDataStatement(
     }
 
     public static String quote(String dbOrTableName) {
-        return "`" + dbOrTableName + "`";
+        return "`" + dbOrTableName.replace("`", "``") + "`";

Review Comment:
   In fact, we do not directly use the table names filled in by users for SQL concatenation.
   1. We will use the table name filled in by the user for regular matching, and then find the `correct table names` in the database.
   2. Then we concatenate the sql using the `correct table names`.
   
   So the SQL we concatenate must use the actual table names that already existed.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org