prestodb/presto · error · SemanticException
NOT_SUPPORTED
NOT_SUPPORTED
Error message
'%s' is a materialized view, and ALTER COLUMN SET/DROP NOT NULL is not supported
What it means
AlterColumnNotNullTask detects that the relation targeted by ALTER COLUMN ... SET/DROP NOT NULL is a materialized view, whose schema is derived from the view definition and cannot have nullability constraints altered. The target name is formatted in; it is a not-supported semantic error, not corruption.
Source
Thrown at presto-main-base/src/main/java/com/facebook/presto/execution/AlterColumnNotNullTask.java:72
return "ALTER COLUMN NOT NULL";
}
@Override
public ListenableFuture<?> execute(AlterColumnNotNull statement, TransactionManager transactionManager, Metadata metadata, AccessControl accessControl, Session session, List<Expression> parameters, WarningCollector warningCollector, String query)
{
QualifiedObjectName tableName = createQualifiedObjectName(session, statement, statement.getTable(), 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()) {
if (!statement.isTableExists()) {
throw new SemanticException(NOT_SUPPORTED, statement, "'%s' is a materialized view, and ALTER COLUMN SET/DROP NOT NULL is not supported", tableName);
}
return immediateFuture(null);
}
ConnectorId connectorId = metadata.getCatalogHandle(session, tableName.getCatalogName())
.orElseThrow(() -> new PrestoException(NOT_FOUND, "Catalog does not exist: " + tableName.getCatalogName()));
Set<ConnectorCapabilities> connectorCapabilities = metadata.getConnectorCapabilities(session, connectorId);
if (!connectorCapabilities.contains(ALTER_COLUMN) || !connectorCapabilities.contains(NOT_NULL_COLUMN_CONSTRAINT)) {
throw new SemanticException(NOT_SUPPORTED, statement, "Catalog %s does not support ALTER COLUMN with NOT NULL", connectorId.getCatalogName());
}
accessControl.checkCanAddConstraints(session.getRequiredTransactionId(), session.getIdentity(), session.getAccessControlContext(), tableName);
TableHandle tableHandle = tableHandleOptional.get();
String column = metadata.normalizeIdentifier(session, tableName.getCatalogName(), statement.getColumn().getValue());
Map<String, ColumnHandle> columnHandles = metadata.getColumnHandles(session, tableHandle);
ColumnHandle columnHandle = columnHandles.get(column);View on GitHub (pinned to 55bb57d202)
Solutions
- Recreate the materialized view with the desired nullability
- Alter the underlying base table instead
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at presto-main-base/src/main/java/com/facebook/presto/execution/AlterColumnNotNullTask.java:72 when the library encounters an invalid state.
Common situations: See trigger scenarios.
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.
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/4c1b8e61668b89bb.
Report an issue: GitHub.