prestodb/presto · error · SemanticException
NOT_SUPPORTED
NOT_SUPPORTED
Error message
'%s' is a materialized view, and drop tag is not supported
What it means
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().
Source
Thrown at presto-main-base/src/main/java/com/facebook/presto/execution/DropTagTask.java:62
return "DROP TAG";
}
@Override
public ListenableFuture<?> execute(DropTag statement, TransactionManager transactionManager, Metadata metadata, AccessControl accessControl, Session session, List<Expression> parameters, WarningCollector warningCollector, String query)
{
QualifiedObjectName tableName = createQualifiedObjectName(session, statement, statement.getTableName(), metadata);
Optional<TableHandle> tableHandleOptional = metadata.getMetadataResolver(session).getTableHandle(tableName);
if (!tableHandleOptional.isPresent()) {
if (!statement.isTableExists()) {
throw new SemanticException(MISSING_TABLE, statement, "Table '%s' does not exist", tableName);
}
return immediateFuture(null);
}
Optional<MaterializedViewDefinition> optionalMaterializedView = metadata.getMetadataResolver(session).getMaterializedView(tableName);
if (optionalMaterializedView.isPresent()) {
throw new SemanticException(NOT_SUPPORTED, statement, "'%s' is a materialized view, and drop tag is not supported", tableName);
}
getConnectorIdOrThrow(session, metadata, tableName.getCatalogName());
accessControl.checkCanDropTag(session.getRequiredTransactionId(), session.getIdentity(), session.getAccessControlContext(), tableName);
metadata.dropTag(session, tableHandleOptional.get(), statement.getTagName(), statement.isTagExists());
return immediateFuture(null);
}
}
View on GitHub (pinned to 55bb57d202)
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
Defensive patterns
Strategy: validation
Validate before calling
-- skip materialized views before DROP TAG SELECT table_type FROM system.metadata.tables WHERE schema_name = 'my_schema' AND table_name = ?;
Try / catch
try { dropTag(...); } catch (SemanticException e) { if (e.getCode() == SemanticErrorCode.NOT_SUPPORTED && e.getErrorMessage().contains("materialized view")) { /* skip MV */ } else { throw e; } } Prevention
- 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
When it happens
Trigger: Executing `DROP TAG ON <name> ...` where the name resolves to a materialized view (metadataResolver.getMaterializedView returns present), regardless of IF EXISTS.
Common situations: Table was converted to a materialized view after tags were applied via scripts; bulk tag-removal tooling iterating over all tables including materialized views.
Understand the failure class
Background: Presto NOT_SUPPORTED error: what "not supported" means and how to fix it — this error's family across 3 libraries.
Related errors
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/238152baead66c6f.
Report an issue: GitHub.