dusukang commented on PR #19741:
URL: https://github.com/apache/flink/pull/19741#issuecomment-1144456068

   Thanks for your update. I also mentioned this in the previous issue.
    I have debugged this case, it will not happen when we use 
mysql-connector-java-5.x. in `com.mysql.jdbc.DatabaseMetaData`, it uses the sql 
to get PK such as:
   ```
   show keys from ${table_name} from ${database_name};
   ```
   but it may happen when we use mysql-connector-java-8.x. in 
`com.mysql.cj.jdbc.DatabaseMetaDataUsingInfoSchema`, it will use the database 
value to the catalog when the following condition established, but it's not 
established, so the catalog is null. then it uses the sql such as @fsk119 
provided to get PK
   ```
           if (catalog == null) {
               if (this.conn.getNullCatalogMeansCurrent()) {
                   catalog = this.database;
               }
           }
   ```
   
   so I think we can do some filtering to resolve tables whose have same name. 


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