prestodb/presto · error · SemanticException

NOT_SUPPORTED

NOT_SUPPORTED

Error message

View rename across schemas is not supported

What it means

SemanticException (NOT_SUPPORTED) from RenameViewTask.execute: Presto view rename is only implemented within a single schema, and the ALTER VIEW ... RENAME target resolves to a different schema (or catalog) than the source view.

Source

Thrown at presto-main-base/src/main/java/com/facebook/presto/execution/RenameViewTask.java:67

        QualifiedObjectName viewName = createQualifiedObjectName(session, statement, statement.getSource(), metadata);

        Optional<ViewDefinition> view = metadata.getMetadataResolver(session).getView(viewName);
        if (!view.isPresent()) {
            if (!statement.isExists()) {
                throw new SemanticException(MISSING_VIEW, statement, "View '%s' does not exist", viewName);
            }
            return immediateFuture(null);
        }

        QualifiedObjectName target = createQualifiedObjectName(session, statement, statement.getTarget(), metadata);
        if (!metadata.getCatalogHandle(session, target.getCatalogName()).isPresent()) {
            throw new SemanticException(MISSING_CATALOG, statement, "Target catalog '%s' does not exist", target.getCatalogName());
        }
        if (metadata.getMetadataResolver(session).getView(target).isPresent()) {
            throw new SemanticException(VIEW_ALREADY_EXISTS, statement, "Target view '%s' already exists", target);
        }
        if (!viewName.getSchemaName().equals(target.getSchemaName())) {
            throw new SemanticException(NOT_SUPPORTED, statement, "View rename across schemas is not supported");
        }
        if (!viewName.getCatalogName().equals(target.getCatalogName())) {
            throw new SemanticException(NOT_SUPPORTED, statement, "View rename across catalogs is not supported");
        }

        accessControl.checkCanRenameView(session.getRequiredTransactionId(), session.getIdentity(), session.getAccessControlContext(), viewName, target);

        metadata.renameView(session, viewName, target);

        return immediateFuture(null);
    }
}

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Recreate the view in the target schema (CREATE VIEW target AS <original query>) and DROP the old one
  2. Restrict the rename to the same schema
  3. Capture the original view definition with SHOW CREATE VIEW before recreating it
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at presto-main-base/src/main/java/com/facebook/presto/execution/RenameViewTask.java:67 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class

Background: Presto NOT_SUPPORTED error: what "not supported" means and how to fix it — this error's family across 3 libraries.


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/fc582e9b516195d9. Report an issue: GitHub.