prestodb/presto · error · SemanticException
NOT_SUPPORTED
NOT_SUPPORTED
Error message
'%s' is a materialized view, and create branch is not supported
What it means
CREATE BRANCH was issued against a materialized view, which Presto does not support branching. The task resolves the target name via metadata.getMetadataResolver(session).getMaterializedView(tableName); if a materialized view definition exists there, it throws SemanticException NOT_SUPPORTED.
Source
Thrown at presto-main-base/src/main/java/com/facebook/presto/execution/CreateBranchTask.java:77
@Override
public String getName()
{
return "CREATE BRANCH";
}
@Override
public ListenableFuture<?> execute(CreateBranch 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 branch is not supported", tableName);
}
getConnectorIdOrThrow(session, metadata, tableName.getCatalogName());
accessControl.checkCanCreateBranch(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 BRANCH 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
- Issue CREATE BRANCH against a base table, not a materialized view
- If a branch of the view's source is needed, branch the underlying table instead
- List relations and confirm the type first (SHOW TABLES / system metadata) to avoid targeting a materialized view
- Adjust automation to skip materialized-view entries when generating CREATE BRANCH statements
Example fix
// before CREATE BRANCH mv_audit_2024 FROM reporting.mv_daily_sales; // after CREATE BRANCH audit_2024 FROM reporting.fact_sales; -- base table, not the materialized view
Defensive patterns
Strategy: validation
Validate before calling
// before CREATE BRANCH, confirm target is a table
boolean isMatView = metadataResolver.getMaterializedView(tableName).isPresent();
if (isMatView) throw new IllegalArgumentException("Cannot branch materialized view: " + tableName); Prevention
- Filter materialized views out of automated branch-creation pipelines
- Check relation type via metadata before branching
- Document that branching applies to tables only in your tooling
When it happens
Trigger: Executing CREATE BRANCH <name> where the target qualified object name refers to a materialized view rather than a table; passing a materialized view name by mistake in migration or snapshotting scripts.
Common situations: Automation that snapshots 'all tables' but enumerates materialized views too; users assuming branches work on any relation in branch-capable catalogs (e.g. lakehouse connectors); renamed tables replaced by materialized views keeping the same name.
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/39d26bd34b98c24d.
Report an issue: GitHub.