use of io.trino.spi.StandardErrorCode.SCHEMA_NOT_FOUND in project trino by trinodb.
the class SetSchemaAuthorizationTask method execute.
@Override
public ListenableFuture<Void> execute(SetSchemaAuthorization statement, QueryStateMachine stateMachine, List<Expression> parameters, WarningCollector warningCollector) {
Session session = stateMachine.getSession();
CatalogSchemaName source = createCatalogSchemaName(session, statement, Optional.of(statement.getSource()));
if (!metadata.schemaExists(session, source)) {
throw semanticException(SCHEMA_NOT_FOUND, statement, "Schema '%s' does not exist", source);
}
TrinoPrincipal principal = createPrincipal(statement.getPrincipal());
checkRoleExists(session, statement, metadata, principal, Optional.of(source.getCatalogName()).filter(catalog -> metadata.isCatalogManagedSecurity(session, catalog)));
accessControl.checkCanSetSchemaAuthorization(session.toSecurityContext(), source, principal);
metadata.setSchemaAuthorization(session, source, principal);
return immediateVoidFuture();
}
Aggregations