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


##########
flink-cdc-connect/flink-cdc-pipeline-connectors/flink-cdc-pipeline-connector-postgres/src/main/java/org/apache/flink/cdc/connectors/postgres/factory/PostgresDataSourceFactory.java:
##########
@@ -369,23 +369,21 @@ private Optional<String> getValidateDatabaseName(String 
tables) {
                     String.format(
                             "Tables format must db.schema.table, can not 
'tables' = %s",
                             TABLES.key()));
-            if (tableNameParts.length == 3) {
-                String currentDbName = tableNameParts[0];
+            String currentDbName = tableNameParts[0];
 
+            checkState(
+                    isValidPostgresDbName(currentDbName),
+                    String.format(
+                            "The value of option %s does not conform to 
PostgresSQL database name naming conventions",
+                            TABLES.key()));
+            if (dbName == null) {
+                dbName = currentDbName;
+            } else {
                 checkState(
-                        isValidPostgresDbName(currentDbName),
+                        dbName.equals(currentDbName),
                         String.format(
-                                "The value of option %s does not conform to 
PostgresSQL database name naming conventions",
+                                "The value of option %s all table names must 
have the same database name",

Review Comment:
   It‘s better to log out `tableNames` In order to troubleshooting.
   
   ```
   checkState(
           dbName.equals(currentDbName),
                   "The value of option %s is %s, but all table names must have 
the same database name",
                   TABLES.key(),
           tableNames);
   ```
   .



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to