prestodb/presto · error · PrestoException
NOT_SUPPORTED
NOT_SUPPORTED
Error message
ALTER MATERIALIZED VIEW ... SET PROPERTIES is not supported when legacy_materialized_views=true
What it means
This PrestoException(NOT_SUPPORTED) guards ALTER MATERIALIZED VIEW ... SET PROPERTIES when the session enables legacy materialized view semantics (legacy_materialized_views=true). Legacy materialized views do not support user-tunable properties, so the operation is refused. It is a feature-availability check, not a syntax or permission error.
Source
Thrown at presto-main-base/src/main/java/com/facebook/presto/execution/SetPropertiesTask.java:71
@Override
public ListenableFuture<?> execute(SetProperties statement, TransactionManager transactionManager, Metadata metadata, AccessControl accessControl, Session session, List<Expression> parameters, WarningCollector warningCollector, String query)
{
QualifiedObjectName tableName = MetadataUtil.createQualifiedObjectName(session, statement, statement.getTableName(), metadata);
Map<String, Expression> sqlProperties = mapFromProperties(statement.getProperties());
if (statement.getType() == TABLE) {
Map<String, Object> properties = metadata.getTablePropertyManager().getUserSpecifiedProperties(
getConnectorIdOrThrow(session, metadata, tableName.getCatalogName()),
tableName.getCatalogName(),
sqlProperties,
session,
metadata,
parameterExtractor(statement, parameters)).build();
setTableProperties(statement, tableName, metadata, accessControl, session, properties);
}
else if (statement.getType() == MATERIALIZED_VIEW) {
if (SystemSessionProperties.isLegacyMaterializedViews(session)) {
throw new PrestoException(NOT_SUPPORTED, "ALTER MATERIALIZED VIEW ... SET PROPERTIES is not supported when legacy_materialized_views=true");
}
Map<String, Object> properties = metadata.getMaterializedViewPropertyManager().getUserSpecifiedProperties(
getConnectorIdOrThrow(session, metadata, tableName.getCatalogName()),
tableName.getCatalogName(),
sqlProperties,
session,
metadata,
parameterExtractor(statement, parameters)).build();
setMaterializedViewProperties(statement, tableName, metadata, accessControl, session, properties);
}
else {
throw new PrestoException(NOT_SUPPORTED, format("Unsupported target type: %s", statement.getType()));
}
return immediateFuture(null);
}
private void setTableProperties(SetProperties statement, QualifiedObjectName tableName, Metadata metadata, AccessControl accessControl, Session session, Map<String, Object> properties)View on GitHub (pinned to 55bb57d202)
Solutions
- Disable the legacy flag for the session: SET SESSION legacy_materialized_views = false; then re-run the ALTER.
- Remove legacy_materialized_views=true from the cluster/catalog configuration if legacy semantics are no longer needed.
- Recreate the materialized view with the desired properties instead of altering it.
Example fix
-- before ALTER MATERIALIZED VIEW mv SET PROPERTIES partitioned_by = ARRAY['day'] -- after SET SESSION legacy_materialized_views = false; ALTER MATERIALIZED VIEW mv SET PROPERTIES partitioned_by = ARRAY['day']
Defensive patterns
Strategy: try-catch
Validate before calling
const rows = await run("SHOW SESSION LIKE 'legacy_materialized_views'");
if (rows.length && rows[0].Value === 'true') {
await run("SET SESSION legacy_materialized_views = false");
} Try / catch
try {
await run("ALTER MATERIALIZED VIEW mv SET PROPERTIES ...");
} catch (e) {
if (e.message.includes("legacy_materialized_views")) {
await run("SET SESSION legacy_materialized_views = false");
await run("ALTER MATERIALIZED VIEW mv SET PROPERTIES ...");
} else throw e;
} Prevention
- Set legacy_materialized_views=false in cluster config once legacy views are migrated.
- Document the flag in team runbooks for materialized-view maintenance.
- Check SHOW SESSION before running materialized-view DDL.
- Prefer recreating materialized views over altering when in legacy mode.
When it happens
Trigger: Running ALTER MATERIALIZED VIEW ... SET PROPERTIES ... while the session property legacy_materialized_views is set to true.
Common situations: Environments migrated from older Presto versions where legacy_materialized_views is enabled in config or at the session/catalog level; DBAs copying modern DDL scripts into a legacy-configured cluster.
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/d834a3da288a5ae7.
Report an issue: GitHub.