georgereuben commented on code in PR #8002:
URL: https://github.com/apache/gravitino/pull/8002#discussion_r2266660068


##########
catalogs/catalog-jdbc-mysql/src/main/java/org/apache/gravitino/catalog/mysql/MysqlCatalogCapability.java:
##########
@@ -39,13 +40,23 @@ public class MysqlCatalogCapability implements Capability {
    */
   public static final String MYSQL_NAME_PATTERN = "^[\\w\\p{L}-$/=]{1,64}$";
 
+  /** Reserved schema andtable names in MySQL that cannot be used for 
user-defined schemas. */
+  private static final Set<String> MYSQL_RESERVED_SCHEMAS =
+      Set.of("mysql", "information_schema", "performance_schema", "sys");
+
   @Override
   public CapabilityResult specificationOnName(Scope scope, String name) {
-    // TODO: Validate the name against reserved words
     if (!name.matches(MYSQL_NAME_PATTERN)) {
       return CapabilityResult.unsupported(
           String.format("The %s name '%s' is illegal.", scope, name));
     }
+
+    if ((scope == Scope.SCHEMA || scope == Scope.TABLE)
+        && MYSQL_RESERVED_SCHEMAS.contains(name.toLowerCase())) {
+      return CapabilityResult.unsupported(

Review Comment:
   Thanks for pointing this out. My initial intention was to prevent conflicts 
by restricting both schema and table names, but I see now that reserved schema 
names like the ones above won't be needed for tables. I'll update the 
validation so that only schema names are checked against MYSQL_RESERVED_SCHEMAS.



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