{"record":{"id":"238152baead66c6f","repo":"prestodb/presto","slug":"not-supported-238152","errorCode":"NOT_SUPPORTED","errorMessage":"'%s' is a materialized view, and drop tag is not supported","messagePattern":"'(.+?)' is a materialized view, and drop tag is not supported","errorType":"error_code","errorClass":"SemanticException","httpStatus":null,"severity":"error","filePath":"presto-main-base/src/main/java/com/facebook/presto/execution/DropTagTask.java","lineNumber":62,"sourceCode":"        return \"DROP TAG\";\n    }\n\n    @Override\n    public ListenableFuture<?> execute(DropTag statement, TransactionManager transactionManager, Metadata metadata, AccessControl accessControl, Session session, List<Expression> parameters, WarningCollector warningCollector, String query)\n    {\n        QualifiedObjectName tableName = createQualifiedObjectName(session, statement, statement.getTableName(), metadata);\n        Optional<TableHandle> tableHandleOptional = metadata.getMetadataResolver(session).getTableHandle(tableName);\n\n        if (!tableHandleOptional.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            throw new SemanticException(NOT_SUPPORTED, statement, \"'%s' is a materialized view, and drop tag is not supported\", tableName);\n        }\n\n        getConnectorIdOrThrow(session, metadata, tableName.getCatalogName());\n        accessControl.checkCanDropTag(session.getRequiredTransactionId(), session.getIdentity(), session.getAccessControlContext(), tableName);\n\n        metadata.dropTag(session, tableHandleOptional.get(), statement.getTagName(), statement.isTagExists());\n        return immediateFuture(null);\n    }\n}\n","sourceCodeStart":44,"sourceCodeEnd":72,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/execution/DropTagTask.java#L44-L72","documentation":"Thrown by DropTagTask when the target table exists but is a materialized view. Tags are not supported on materialized views, so the task raises NOT_SUPPORTED unconditionally (no IF EXISTS escape) after detecting optionalMaterializedView.isPresent().","triggerScenarios":"Executing `DROP TAG ON <name> ...` where the name resolves to a materialized view (metadataResolver.getMaterializedView returns present), regardless of IF EXISTS.","commonSituations":"Table was converted to a materialized view after tags were applied via scripts; bulk tag-removal tooling iterating over all tables including materialized views.","solutions":["Skip materialized views in the tag cleanup script by checking the object type first","If the tag is no longer meaningful, drop and recreate the object as a table or manage the view's tags via the connector's supported mechanism","File/use connector support for materialized-view tags if your use case requires it"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"-- skip materialized views before DROP TAG\nSELECT table_type FROM system.metadata.tables\nWHERE schema_name = 'my_schema' AND table_name = ?;","typeGuard":null,"tryCatchPattern":"try { dropTag(...); } catch (SemanticException e) { if (e.getCode() == SemanticErrorCode.NOT_SUPPORTED && e.getErrorMessage().contains(\"materialized view\")) { /* skip MV */ } else { throw e; } }","preventionTips":["Exclude materialized views when enumerating tables for tag operations","Check object type via metadata API before issuing tag DDL","Keep tag-management scripts in sync with schema changes that convert tables to MVs"],"tags":["presto","sql","materialized-view","tag","not-supported"],"backgroundTag":"wrong-object-type-drop","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-12T02:17:10.037Z"}