{"record":{"id":"fc582e9b516195d9","repo":"prestodb/presto","slug":"not-supported-fc582e","errorCode":"NOT_SUPPORTED","errorMessage":"View rename across schemas is not supported","messagePattern":"View rename across schemas is not supported","errorType":"error_code","errorClass":"SemanticException","httpStatus":null,"severity":"error","filePath":"presto-main-base/src/main/java/com/facebook/presto/execution/RenameViewTask.java","lineNumber":67,"sourceCode":"        QualifiedObjectName viewName = createQualifiedObjectName(session, statement, statement.getSource(), metadata);\n\n        Optional<ViewDefinition> view = metadata.getMetadataResolver(session).getView(viewName);\n        if (!view.isPresent()) {\n            if (!statement.isExists()) {\n                throw new SemanticException(MISSING_VIEW, statement, \"View '%s' does not exist\", viewName);\n            }\n            return immediateFuture(null);\n        }\n\n        QualifiedObjectName target = createQualifiedObjectName(session, statement, statement.getTarget(), metadata);\n        if (!metadata.getCatalogHandle(session, target.getCatalogName()).isPresent()) {\n            throw new SemanticException(MISSING_CATALOG, statement, \"Target catalog '%s' does not exist\", target.getCatalogName());\n        }\n        if (metadata.getMetadataResolver(session).getView(target).isPresent()) {\n            throw new SemanticException(VIEW_ALREADY_EXISTS, statement, \"Target view '%s' already exists\", target);\n        }\n        if (!viewName.getSchemaName().equals(target.getSchemaName())) {\n            throw new SemanticException(NOT_SUPPORTED, statement, \"View rename across schemas is not supported\");\n        }\n        if (!viewName.getCatalogName().equals(target.getCatalogName())) {\n            throw new SemanticException(NOT_SUPPORTED, statement, \"View rename across catalogs is not supported\");\n        }\n\n        accessControl.checkCanRenameView(session.getRequiredTransactionId(), session.getIdentity(), session.getAccessControlContext(), viewName, target);\n\n        metadata.renameView(session, viewName, target);\n\n        return immediateFuture(null);\n    }\n}\n","sourceCodeStart":49,"sourceCodeEnd":80,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/execution/RenameViewTask.java#L49-L80","documentation":"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.","triggerScenarios":"Thrown at presto-main-base/src/main/java/com/facebook/presto/execution/RenameViewTask.java:67 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Recreate the view in the target schema (CREATE VIEW target AS <original query>) and DROP the old one","Restrict the rename to the same schema","Capture the original view definition with SHOW CREATE VIEW before recreating it"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}