prestodb/presto · error · PrestoException

NOT_SUPPORTED

NOT_SUPPORTED

Error message

Temporary table cannot be created in catalog "%s": %s

What it means

PhysicalCteOptimizer materializes CTEs by creating temporary tables via a partitioning provider in the configured catalog. When the underlying creation fails with NOT_SUPPORTED, it re-wraps the error clarifying that the target catalog does not support temporary tables. This happens when the catalog chosen for CTE materialization lacks temporary/temp-table DDL support.

Source

Thrown at presto-main-base/src/main/java/com/facebook/presto/sql/planner/optimizations/PhysicalCteOptimizer.java:146

                        partitioningProviderCatalog,
                        ImmutableList.copyOf(variableToColumnMap.values()),
                        Optional.empty());
                context.get().put(node.getCteId(),
                        new PhysicalCteTransformerContext.TemporaryTableInfo(
                                createTemporaryTableScan(
                                        metadata,
                                        session,
                                        idAllocator,
                                        node.getSourceLocation(),
                                        temporaryTableHandle,
                                        actualSource.getOutputVariables(),
                                        variableToColumnMap,
                                        Optional.empty(),
                                        Optional.of(node.getCteId())), node.getOutputVariables()));
            }
            catch (PrestoException e) {
                if (e.getErrorCode().equals(NOT_SUPPORTED.toErrorCode())) {
                    throw new PrestoException(
                            NOT_SUPPORTED,
                            format("Temporary table cannot be created in catalog \"%s\": %s", partitioningProviderCatalog, e.getMessage()),
                            e);
                }
                throw e;
            }
            // Create the writer
            return createTemporaryTableWriteWithoutExchanges(
                    metadata,
                    session,
                    idAllocator,
                    variableAllocator,
                    actualSource,
                    temporaryTableHandle,
                    actualSource.getOutputVariables(),
                    variableToColumnMap,
                    node.getRowCountVariable(),
                    Optional.of(node.getCteId()));

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Change the catalog used for CTE temporary tables to one that supports table creation (e.g. Hive with write access or a memory connector).
  2. Check connector capabilities/permissions for CREATE TABLE in the configured catalog.
  3. Disable CTE materialization if not required (adjust the session/feature flag controlling physical CTE execution).

Example fix

// before (config)
cte-partitioning-provider-catalog=readonly-hive
// after
cte-partitioning-provider-catalog=hive-writable  # or memory catalog supporting CREATE TABLE
Defensive patterns

Strategy: validation

Validate before calling

// before enabling CTE materialization, verify the catalog supports CREATE TABLE
// e.g. run: CREATE TABLE tmp_catalog.schema.__probe (x INTEGER); DROP TABLE tmp_catalog.schema.__probe;

Try / catch

try {
    execute(cteQuery);
} catch (PrestoException e) {
    if ("NOT_SUPPORTED".equals(e.getErrorCode().getName()) && e.getMessage().contains("Temporary table cannot be created")) {
        execute(withCteMaterializationDisabled(cteQuery)); // fallback: inline CTEs
    } else throw e;
}

Prevention

When it happens

Trigger: Executing a query containing CTEs when CTE materialization is enabled and the partitioning provider catalog (configured for temporary tables) rejects the temp-table creation as NOT_SUPPORTED — e.g. a connector that cannot create tables, lacks the required DDL, or the catalog is read-only.

Common situations: Pointing temp-table catalog at a connector like a read-only Hive/InformationSchema-like catalog; missing write permissions configured at connector level; using a catalog version/connector that predates temporary-table support.

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/2df0da23fc9dfe84. Report an issue: GitHub.