Skip to content

Commit e63365b

Browse files
author
zstan
committed
fix after review
1 parent b133a33 commit e63365b

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

modules/catalog/src/main/java/org/apache/ignite/internal/catalog/commands/CreateSchemaCommand.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,14 @@ public class CreateSchemaCommand implements CatalogCommand {
4949
private CreateSchemaCommand(String schemaName, boolean ifNotExists, boolean systemSchemaCommand) {
5050
validateIdentifier(schemaName, "Name of the schema");
5151

52-
if (systemSchemaCommand && !CatalogUtils.isSystemSchema(schemaName)) {
53-
throw new CatalogValidationException(format("Not a system schema, schema: '{}'", schemaName));
52+
if (systemSchemaCommand) {
53+
if (!CatalogUtils.isSystemSchema(schemaName)) {
54+
throw new CatalogValidationException(format("Not a system schema, schema: '{}'", schemaName));
55+
}
56+
} else {
57+
if (CatalogUtils.isSystemSchema(schemaName)) {
58+
throw new CatalogValidationException("Reserved system schema with name '{}' can't be created.", schemaName);
59+
}
5460
}
5561

5662
this.schemaName = schemaName;
@@ -65,10 +71,6 @@ public boolean ifNotExists() {
6571
/** {@inheritDoc} */
6672
@Override
6773
public List<UpdateEntry> get(UpdateContext updateContext) {
68-
if (!systemSchemaCommand && CatalogUtils.isSystemSchema(schemaName)) {
69-
throw new CatalogValidationException("Reserved system schema with name '{}' can't be created.", schemaName);
70-
}
71-
7274
Catalog catalog = updateContext.catalog();
7375
int id = catalog.objectIdGenState();
7476

0 commit comments

Comments
 (0)