prestodb/presto · error · PrestoException
NOT_SUPPORTED
NOT_SUPPORTED
Error message
Cannot write to non-managed Hive table
What it means
Writes are only allowed to MANAGED_TABLE, MATERIALIZED_VIEW, or TEMPORARY_TABLE types; external/non-managed Hive tables are treated as read-only data owned outside Presto. checkTableWritable throws NOT_SUPPORTED when writesToNonManagedTablesEnabled is false (the default) and the target table type is not one of the writable types.
Source
Thrown at presto-hive/src/main/java/com/facebook/presto/hive/HiveTableWritabilityChecker.java:55
public HiveTableWritabilityChecker(HiveClientConfig hiveClientConfig)
{
this(requireNonNull(hiveClientConfig, "hiveClientConfig is null").getWritesToNonManagedTablesEnabled());
}
public HiveTableWritabilityChecker(boolean writesToNonManagedTablesEnabled)
{
this.writesToNonManagedTablesEnabled = writesToNonManagedTablesEnabled;
}
@Override
public void checkTableWritable(Table table)
{
PrestoTableType tableType = table.getTableType();
if (!writesToNonManagedTablesEnabled
&& !tableType.equals(MANAGED_TABLE)
&& !tableType.equals(MATERIALIZED_VIEW)
&& !tableType.equals(TEMPORARY_TABLE)) {
throw new PrestoException(NOT_SUPPORTED, "Cannot write to non-managed Hive table");
}
checkWritable(
table.getSchemaTableName(),
Optional.empty(),
getProtectMode(table),
table.getParameters(),
table.getStorage());
}
}
View on GitHub (pinned to 55bb57d202)
Solutions
- Write to a managed table instead, or convert the target to managed: ALTER TABLE ... SET PROPERTIES external_location / recreate as managed
- Enable the connector config hive.non-managed-table-writes-enabled=true if the environment permits non-managed writes
- Check table type via SHOW CREATE TABLE to confirm it is external before writing
Example fix
-- before (external table) INSERT INTO ext_table SELECT ...; -- fails -- after ALTER TABLE ext_table UNSET PROPERTIES external_location; -- or recreate as managed INSERT INTO ext_table SELECT ...;
Defensive patterns
Strategy: validation
Validate before calling
if (!table.getTableType().equals(PrestoTableType.MANAGED_TABLE)
&& !table.getTableType().equals(PrestoTableType.MATERIALIZED_VIEW)
&& !table.getTableType().equals(PrestoTableType.TEMPORARY_TABLE)) {
throw new IllegalStateException("target is non-managed; writes disabled");
} Type guard
boolean isWritableType(PrestoTableType t) {
return t == PrestoTableType.MANAGED_TABLE || t == PrestoTableType.MATERIALIZED_VIEW || t == PrestoTableType.TEMPORARY_TABLE;
} Try / catch
try { insertInto(table); } catch (PrestoException e) { if (e.getErrorCode().getName().equals("NOT_SUPPORTED")) { /* write to a managed staging table instead */ } else throw e; } Prevention
- Run SHOW CREATE TABLE to confirm the table is managed before INSERT/UPDATE/DELETE
- Only enable hive.non-managed-table-writes-enabled when the ownership model allows it
- Route writes through managed staging tables and CTAS
When it happens
Trigger: INSERT INTO / UPDATE / DELETE / CREATE TABLE AS targeting a table whose PrestoTableType is EXTERNAL_TABLE (or any non-managed type) while the hive.non-managed-table-writes-enabled config is false.
Common situations: Pointing an INSERT at an external table backed by shared data; attempting writes after converting a managed table to external; environments where the safety config was intentionally left at its default.
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/0a9b2fb65ad91531.
Report an issue: GitHub.