prestodb/presto · error · SemanticException
NOT_SUPPORTED
NOT_SUPPORTED
Error message
'%s' is a materialized view, and create tag is not supported
What it means
CREATE TAG was executed against a name that resolves to a materialized view. Tags are only supported on tables, so CreateTagTask.execute checks getMaterializedView(tableName) and rejects with NOT_SUPPORTED before any connector work.
Source
Thrown at presto-main-base/src/main/java/com/facebook/presto/execution/CreateTagTask.java:77
@Override
public String getName()
{
return "CREATE TAG";
}
@Override
public ListenableFuture<?> execute(CreateTag 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 (statement.isTableExists() && !tableHandleOptional.isPresent()) {
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 create tag is not supported", tableName);
}
getConnectorIdOrThrow(session, metadata, tableName.getCatalogName());
accessControl.checkCanCreateTag(session.getRequiredTransactionId(), session.getIdentity(), session.getAccessControlContext(), tableName);
if (statement.isReplace() && statement.isIfNotExists()) {
throw new SemanticException(NOT_SUPPORTED, statement,
"Cannot specify both OR REPLACE and IF NOT EXISTS in CREATE TAG statement");
}
Optional<ConnectorTableVersion> tableVersion = Optional.empty();
if (statement.getTableVersion().isPresent()) {
TableVersionExpression tableVersionExpr = statement.getTableVersion().get();
Expression stateExpr = tableVersionExpr.getStateExpression();
TableVersionExpression.TableVersionType tableVersionType = tableVersionExpr.getTableVersionType();
TableVersionExpression.TableVersionOperator tableVersionOperator = tableVersionExpr.getTableVersionOperator();
View on GitHub (pinned to 55bb57d202)
Solutions
- Target a base table with CREATE TAG instead of a materialized view.
- Skip or filter materialized views out of any automated tagging script.
- Use the materialized view's underlying table if tagging the source data is the goal.
Example fix
// before CREATE TAG my_mv TAG 'v1'; -- my_mv is a materialized view // after CREATE TAG my_table TAG 'v1'; -- a real table
Defensive patterns
Strategy: validation
Validate before calling
Optional<MaterializedViewDefinition> mv = metadata.getMetadataResolver(session).getMaterializedView(tableName);
if (mv.isPresent()) {
throw new IllegalArgumentException(tableName + " is a materialized view; tags are not supported");
} Type guard
boolean isMaterializedView(Session s, Metadata m, QualifiedObjectName name) {
return m.getMetadataResolver(s).getMaterializedView(name).isPresent();
} Try / catch
try {
future = createTagTask.execute(statement, ...);
} catch (SemanticException e) {
if (e.getCode() == NOT_SUPPORTED && e.getMessage().contains("materialized view")) {
// retarget the CREATE TAG at the base table
}
} Prevention
- Resolve object type (system metadata / information_schema) before scripting CREATE TAG.
- Filter materialized views out of batch tagging jobs.
- Document that tags apply to base tables only.
When it happens
Trigger: CREATE TAG <mv_name> ... (or CREATE TAG IF EXISTS variant) where the qualified object name resolves to a materialized view definition via metadata.getMetadataResolver(session).
Common situations: Assuming tags work on all catalog objects; scripting tag creation over a list of names that includes materialized views; confusion between tables and materialized views in Iceberg-style catalogs.
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/c735c59bdbf7f091.
Report an issue: GitHub.