{"record":{"id":"f4acc0d72e6ce6f7","repo":"prestodb/presto","slug":"cannot-create-view-s-s","errorCode":null,"errorMessage":"Cannot create view %s%s","messagePattern":"Cannot create view (.+?)(.+?)","errorType":"exception","errorClass":"AccessDeniedException","httpStatus":null,"severity":"error","filePath":"presto-spi/src/main/java/com/facebook/presto/spi/security/AccessDeniedException.java","lineNumber":267,"sourceCode":"\n    public static void denyUpdateTableColumns(String tableName, Set<String> updatedColumnNames)\n    {\n        denyUpdateTableColumns(tableName, updatedColumnNames, null);\n    }\n\n    public static void denyUpdateTableColumns(String tableName, Set<String> updatedColumnNames, String extraInfo)\n    {\n        throw new AccessDeniedException(format(\"Cannot update columns [%s] in table %s%s\", updatedColumnNames, tableName, formatExtraInfo(extraInfo)));\n    }\n\n    public static void denyCreateView(String viewName)\n    {\n        denyCreateView(viewName, null);\n    }\n\n    public static void denyCreateView(String viewName, String extraInfo)\n    {\n        throw new AccessDeniedException(format(\"Cannot create view %s%s\", viewName, formatExtraInfo(extraInfo)));\n    }\n\n    public static void denyCreateViewWithSelect(String sourceName, Identity identity)\n    {\n        denyCreateViewWithSelect(sourceName, identity.toConnectorIdentity());\n    }\n\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)","sourceCodeStart":249,"sourceCodeEnd":285,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-spi/src/main/java/com/facebook/presto/spi/security/AccessDeniedException.java#L249-L285","documentation":"Thrown when the identity attempting CREATE VIEW lacks the CREATE_VIEW privilege on the target schema. The connector's access controller calls denyCreateView during checkCanCreateView. It indicates an authorization failure at the SPI security layer before the view metadata is written.","triggerScenarios":"Executing CREATE VIEW <name> AS ... when AccessControlManager.checkCanCreateView dispatches to the connector authorizer and it denies the operation for the current identity/schema.","commonSituations":"Non-privileged users creating views in schemas they do not own; tightened system access control (e.g. file-based security.json) without schema-owner rules; connector plugins denying view creation entirely.","solutions":["Grant the user CREATE_VIEW privilege on the target schema (or make them schema owner)","Adjust system access control rules (e.g. security.json schema owner rules) to allow the user","Use a role that has the required grant and re-run CREATE VIEW"],"exampleFix":"// before\nCREATE VIEW analytics.daily AS SELECT ...; -- AccessDeniedException\n// after (as admin)\nGRANT CREATE VIEW ON SCHEMA analytics TO USER bob;","handlingStrategy":"try-catch","validationCode":"// precheck: user should already be able to SELECT sources and own/create in schema\nboolean canCreate = catalogAdmin.userHasPrivilege(user, schema, \"CREATE_VIEW\");","typeGuard":null,"tryCatchPattern":"try {\n    execute(\"CREATE VIEW \" + name + \" AS \" + query);\n} catch (AccessDeniedException e) {\n    log.error(\"CREATE VIEW denied: {}\", e.getMessage());\n    throw new SecurityException(\"User lacks CREATE_VIEW on schema \" + schema, e);\n}","preventionTips":["Grant CREATE_VIEW on required schemas to developer/service roles","Align schema ownership with team structure so owners can create views","Verify run-as identity in BI tools matches the granted principal"],"tags":["security","authorization","access-denied","views"],"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"}