{"record":{"id":"6dfc1533cdd29651","repo":"prestodb/presto","slug":"invalid-materialized-view-property","errorCode":"INVALID_MATERIALIZED_VIEW_PROPERTY","errorMessage":"Materialized view property is not updatable: %s","messagePattern":"Materialized view property is not updatable: (.+?)","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergMaterializedViewProperties.java","lineNumber":170,"sourceCode":"        requireNonNull(tableProperties, \"tableProperties is null\");\n\n        // Combine table properties (for storage table) with MV-specific properties\n        materializedViewProperties = ImmutableList.<PropertyMetadata<?>>builder()\n                .addAll(tableProperties.getTableProperties())\n                .addAll(MV_ONLY_PROPERTIES.stream().map(MaterializedViewProperty::metadata).iterator())\n                .build();\n    }\n\n    public List<PropertyMetadata<?>> getMaterializedViewProperties()\n    {\n        return materializedViewProperties;\n    }\n\n    public static Map.Entry<String, String> serializeForUpdate(String name, Object value)\n    {\n        MaterializedViewProperty property = MV_ONLY_PROPERTIES_BY_NAME.get(name);\n        if (property == null || !property.updatable()) {\n            throw new PrestoException(INVALID_MATERIALIZED_VIEW_PROPERTY,\n                    format(\"Materialized view property is not updatable: %s\", name));\n        }\n        if (value == null) {\n            throw new PrestoException(NOT_SUPPORTED,\n                    format(\"Clearing materialized view property %s is not supported\", name));\n        }\n        return Map.entry(property.storageKey(), property.serializer().apply(value));\n    }\n\n    private static MaterializedViewProperty creationOnly(PropertyMetadata<?> metadata, String storageKey)\n    {\n        return new MaterializedViewProperty(metadata, storageKey, null);\n    }\n\n    private static MaterializedViewProperty updatable(PropertyMetadata<?> metadata, String storageKey, Function<Object, String> serializer)\n    {\n        return new MaterializedViewProperty(metadata, storageKey, requireNonNull(serializer, \"serializer is null\"));\n    }","sourceCodeStart":152,"sourceCodeEnd":188,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergMaterializedViewProperties.java#L152-L188","documentation":"This error is thrown when trying to UPDATE a materialized view property that either does not exist in the Iceberg materialized view property registry (MV_ONLY_PROPERTIES_BY_NAME) or is marked as not updatable (creation-only). Iceberg materialized views have some properties that can only be set at creation time; serializeForUpdate validates every property change against the updatable() flag before serializing the new value.","triggerScenarios":"Calling ALTER MATERIALIZED VIEW ... SET PROPERTIES (which routes to serializeForUpdate) with a property name that is unknown to the Iceberg connector, or with a property that was registered via creationOnly(...) and therefore has updatable() == false.","commonSituations":"Typo in the property name in ALTER MATERIALIZED VIEW; attempting to modify a creation-only Iceberg MV property (e.g. one controlling storage layout) after the view exists; applying a generic Presto ALTER statement assuming all MV properties are mutable; version drift where a property was updatable in a newer Presto but not in the deployed one.","solutions":["Check the property name against IcebergMaterializedViewProperties (MV_ONLY_PROPERTIES_BY_NAME) for exact spelling.","Verify with the connector docs whether the property is creation-only; if so, drop and recreate the materialized view with the desired value.","Only pass properties whose updatable() returns true; filter the SET PROPERTIES list accordingly.","Upgrade Presto if a newer version marks the property as updatable."],"exampleFix":"// before\nALTER MATERIALIZED VIEW mv SET PROPERTIES some_creation_only_prop = 'x';\n// after\n-- recreate the view with the creation-only property\nDROP MATERIALIZED VIEW mv;\nCREATE MATERIALIZED VIEW mv WITH (some_creation_only_prop = 'x') AS SELECT ...;","handlingStrategy":"validation","validationCode":"// Java: validate before calling serializeForUpdate / issuing ALTER\nMaterializedViewProperty prop = MV_ONLY_PROPERTIES_BY_NAME.get(name);\nif (prop == null) throw new IllegalArgumentException(\"Unknown MV property: \" + name);\nif (!prop.updatable()) throw new IllegalArgumentException(\"Property is creation-only: \" + name);","typeGuard":"boolean isUpdatableProperty(String name) {\n    MaterializedViewProperty p = MV_ONLY_PROPERTIES_BY_NAME.get(name);\n    return p != null && p.updatable();\n}","tryCatchPattern":"try {\n    serializeForUpdate(name, value);\n} catch (PrestoException e) {\n    if (e.getErrorCode().getCode() == StandardErrorCode.INVALID_MATERIALIZED_VIEW_PROPERTY.getCode()) {\n        // skip or recreate view; property is creation-only or unknown\n    } else throw e;\n}","preventionTips":["Keep a list of updatable property names in application config and validate against it before ALTER.","Check IcebergMaterializedViewProperties source for which properties use creationOnly().","Never apply generic ALTER MV property scripts blindly across connectors.","Pin Presto version and re-verify property updatability on upgrade."],"tags":["presto","iceberg","materialized-view","invalid-property"],"backgroundTag":"invalid-materialized-view-property","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}