strongduanmu opened a new issue, #16086:
URL: https://github.com/apache/shardingsphere/issues/16086

   ## Feature Request
   
   To support handling of foreign key constraints in issue #16050, 
ConstraintMetaData needs to be added to the metadata. 
   
   Add `Map<String, Constraint MetaData> constraints` to TableMetaData:
   
   ```java
   /**
    * Table meta data.
    */
   @Getter
   @EqualsAndHashCode
   @ToString
   public final class TableMetaData {
       
       private final String name;
       
       private final Map<String, ColumnMetaData> columns;
       
       private final Map<String, IndexMetaData> indexes;
       
       private final Map<String, ConstraintMetaData> constrains;
       
       private final List<String> primaryKeyColumns = new ArrayList<>();
   }
   
   /**
    * Constraint meta data.
    */
   @RequiredArgsConstructor
   @Getter
   @EqualsAndHashCode
   @ToString
   public final class ConstraintMetaData {
       
       private final String name;
       
       private final String referencedTableName;
   }
   ```
   
   Then add query logic for constraints in MySQLTableMetaDataLoader.
   
   ```sql
   SELECT CONSTRAINT_NAME, TABLE_NAME, COLUMN_NAME, REFERENCED_TABLE_NAME, 
REFERENCED_COLUMN_NAME FROM information_schema.KEY_COLUMN_USAGE
          WHERE TABLE_NAME IN ('bmsql_district_0') AND REFERENCED_TABLE_SCHEMA 
IS NOT NULL;
   ```
   
   - [x] Support MySQL constraint meta data load
   - [x] Support Postgresql constraint meta data load
   - [ ] Support openGauss constraint meta data load
   - [ ] Support Oracle constraint meta data load
   - [ ] Support SQLServer constraint meta data load
   
   ### Is your feature request related to a problem?
   
   issue #16050
   
   ### Describe the feature you would like.
   


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