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


##########
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),

Review Comment:
   postgres pipeline can only support ingest of tables under the same dbName, 
and should raise an exception if there are duplicate databases. checkState 
false throws an exception, duplicates the database !dbName=currentDBName.



-- 
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