{"record":{"id":"7c9a4c576c6aed8c","repo":"prestodb/presto","slug":"not-supported-7c9a4c","errorCode":"NOT_SUPPORTED","errorMessage":"'%s' is a materialized view, and add column is not supported","messagePattern":"'(.+?)' is a materialized view, and add column is not supported","errorType":"error_code","errorClass":"SemanticException","httpStatus":null,"severity":"error","filePath":"presto-main-base/src/main/java/com/facebook/presto/execution/AddColumnTask.java","lineNumber":84,"sourceCode":"        return \"ADD COLUMN\";\n    }\n\n    @Override\n    public ListenableFuture<?> execute(AddColumn statement, TransactionManager transactionManager, Metadata metadata, AccessControl accessControl, Session session, List<Expression> parameters, WarningCollector warningCollector, String query)\n    {\n        QualifiedObjectName tableName = createQualifiedObjectName(session, statement, statement.getName(), metadata);\n        Optional<TableHandle> tableHandle = metadata.getMetadataResolver(session).getTableHandle(tableName);\n        if (!tableHandle.isPresent()) {\n            if (!statement.isTableExists()) {\n                throw new SemanticException(MISSING_TABLE, statement, \"Table '%s' does not exist\", tableName);\n            }\n            return immediateFuture(null);\n        }\n\n        Optional<MaterializedViewDefinition> optionalMaterializedView = metadata.getMetadataResolver(session).getMaterializedView(tableName);\n        if (optionalMaterializedView.isPresent()) {\n            if (!statement.isTableExists()) {\n                throw new SemanticException(NOT_SUPPORTED, statement, \"'%s' is a materialized view, and add column is not supported\", tableName);\n            }\n            return immediateFuture(null);\n        }\n\n        ConnectorId connectorId = getConnectorIdOrThrow(session, metadata, tableName.getCatalogName());\n\n        accessControl.checkCanAddColumns(session.getRequiredTransactionId(), session.getIdentity(), session.getAccessControlContext(), tableName);\n\n        Map<String, ColumnHandle> columnHandles = metadata.getColumnHandles(session, tableHandle.get());\n\n        ColumnDefinition element = statement.getColumn();\n        Type type;\n        try {\n            type = metadata.getType(parseTypeSignature(element.getType()));\n        }\n        catch (IllegalArgumentException | UnknownTypeException e) {\n            throw new SemanticException(TYPE_MISMATCH, element, \"Unknown type '%s' for column '%s'\", element.getType(), element.getName());\n        }","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/execution/AddColumnTask.java#L66-L102","documentation":"AddColumnTask refuses to run ALTER TABLE ... ADD COLUMN when the target named by the statement resolves to a materialized view rather than a plain table. The table name is formatted into the message; this is a semantic limitation of the ADD COLUMN path, raised during analysis of the statement.","triggerScenarios":"Thrown at presto-main-base/src/main/java/com/facebook/presto/execution/AddColumnTask.java:84 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Recreate the materialized view with the desired schema instead of altering it","Apply ADD COLUMN to the underlying base table where appropriate"],"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"}