{"record":{"id":"b2870419a560b37e","repo":"prestodb/presto","slug":"cannot-rename-view-from-s-to-s-s","errorCode":null,"errorMessage":"Cannot rename view from %s to %s%s","messagePattern":"Cannot rename view from (.+?) to (.+?)(.+?)","errorType":"exception","errorClass":"AccessDeniedException","httpStatus":null,"severity":"error","filePath":"presto-spi/src/main/java/com/facebook/presto/spi/security/AccessDeniedException.java","lineNumber":292,"sourceCode":"\n    public static void denyCreateViewWithSelect(String sourceName, ConnectorIdentity identity)\n    {\n        denyCreateViewWithSelect(sourceName, identity, null);\n    }\n\n    public static void denyCreateViewWithSelect(String sourceName, ConnectorIdentity identity, String extraInfo)\n    {\n        throw new AccessDeniedException(format(\"View owner '%s' cannot create view that selects from %s%s\", identity.getUser(), sourceName, formatExtraInfo(extraInfo)));\n    }\n\n    public static void denyRenameView(String viewName, String newViewName)\n    {\n        denyRenameView(viewName, newViewName, null);\n    }\n\n    public static void denyRenameView(String viewName, String newViewName, String extraInfo)\n    {\n        throw new AccessDeniedException(format(\"Cannot rename view from %s to %s%s\", viewName, newViewName, formatExtraInfo(extraInfo)));\n    }\n\n    public static void denyDropView(String viewName)\n    {\n        denyDropView(viewName, null);\n    }\n\n    public static void denyDropView(String viewName, String extraInfo)\n    {\n        throw new AccessDeniedException(format(\"Cannot drop view %s%s\", viewName, formatExtraInfo(extraInfo)));\n    }\n\n    public static void denySelectView(String viewName)\n    {\n        denySelectView(viewName, null);\n    }\n\n    public static void denySelectView(String viewName, String extraInfo)","sourceCodeStart":274,"sourceCodeEnd":310,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-spi/src/main/java/com/facebook/presto/spi/security/AccessDeniedException.java#L274-L310","documentation":"Thrown when the identity lacks the RENAME_VIEW (ownership) privilege on a view. The connector authorizer calls denyRenameView during checkCanRenameView, rejecting ALTER VIEW ... RENAME. Only the view owner or an authorized principal may rename it.","triggerScenarios":"ALTER VIEW old RENAME TO new where AccessControlManager.checkCanRenameView is denied for the current identity.","commonSituations":"Non-owner attempting rename; ownership transferred after original creator left; connectors that never grant rename to non-admins.","solutions":["Run the rename as the view's owner or an admin","Set the view owner to the requesting principal (e.g. ALTER VIEW ... SET AUTHORIZATION)","Adjust the access control rules to grant RENAME_VIEW"],"exampleFix":"// before\nALTER VIEW analytics.daily RENAME TO analytics.daily_v2; -- AccessDeniedException\n// after (as owner/admin or after)\nALTER VIEW analytics.daily SET AUTHORIZATION bob;\nALTER VIEW analytics.daily RENAME TO analytics.daily_v2;","handlingStrategy":"try-catch","validationCode":"// confirm requester is the view owner before attempting rename\nboolean isOwner = viewOwner.equals(requestingUser) || catalogAdmin.isAdmin(requestingUser);","typeGuard":null,"tryCatchPattern":"try {\n    execute(\"ALTER VIEW \" + oldName + \" RENAME TO \" + newName);\n} catch (AccessDeniedException e) {\n    throw new SecurityException(\"Only the view owner may rename \" + oldName, e);\n}","preventionTips":["Rename views with the account that created them","Use SET AUTHORIZATION to transfer ownership before reorganization scripts","Avoid ad-hoc renames by shared admin accounts when ownership matters"],"tags":["security","authorization","views","rename"],"backgroundTag":"access-denied","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"}