yuqi1129 commented on code in PR #8002:
URL: https://github.com/apache/gravitino/pull/8002#discussion_r2266544176
##########
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:
I can't get why tables name like `performance_schema` and `sys` are also not
supported.
--
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]