{"record":{"id":"2df0da23fc9dfe84","repo":"prestodb/presto","slug":"not-supported-2df0da","errorCode":"NOT_SUPPORTED","errorMessage":"Temporary table cannot be created in catalog \"%s\": %s","messagePattern":"Temporary table cannot be created in catalog \"(.+?)\": (.+?)","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-main-base/src/main/java/com/facebook/presto/sql/planner/optimizations/PhysicalCteOptimizer.java","lineNumber":146,"sourceCode":"                        partitioningProviderCatalog,\n                        ImmutableList.copyOf(variableToColumnMap.values()),\n                        Optional.empty());\n                context.get().put(node.getCteId(),\n                        new PhysicalCteTransformerContext.TemporaryTableInfo(\n                                createTemporaryTableScan(\n                                        metadata,\n                                        session,\n                                        idAllocator,\n                                        node.getSourceLocation(),\n                                        temporaryTableHandle,\n                                        actualSource.getOutputVariables(),\n                                        variableToColumnMap,\n                                        Optional.empty(),\n                                        Optional.of(node.getCteId())), node.getOutputVariables()));\n            }\n            catch (PrestoException e) {\n                if (e.getErrorCode().equals(NOT_SUPPORTED.toErrorCode())) {\n                    throw new PrestoException(\n                            NOT_SUPPORTED,\n                            format(\"Temporary table cannot be created in catalog \\\"%s\\\": %s\", partitioningProviderCatalog, e.getMessage()),\n                            e);\n                }\n                throw e;\n            }\n            // Create the writer\n            return createTemporaryTableWriteWithoutExchanges(\n                    metadata,\n                    session,\n                    idAllocator,\n                    variableAllocator,\n                    actualSource,\n                    temporaryTableHandle,\n                    actualSource.getOutputVariables(),\n                    variableToColumnMap,\n                    node.getRowCountVariable(),\n                    Optional.of(node.getCteId()));","sourceCodeStart":128,"sourceCodeEnd":164,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/sql/planner/optimizations/PhysicalCteOptimizer.java#L128-L164","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Change the catalog used for CTE temporary tables to one that supports table creation (e.g. Hive with write access or a memory connector).","Check connector capabilities/permissions for CREATE TABLE in the configured catalog.","Disable CTE materialization if not required (adjust the session/feature flag controlling physical CTE execution)."],"exampleFix":"// before (config)\ncte-partitioning-provider-catalog=readonly-hive\n// after\ncte-partitioning-provider-catalog=hive-writable  # or memory catalog supporting CREATE TABLE","handlingStrategy":"validation","validationCode":"// before enabling CTE materialization, verify the catalog supports CREATE TABLE\n// e.g. run: CREATE TABLE tmp_catalog.schema.__probe (x INTEGER); DROP TABLE tmp_catalog.schema.__probe;","typeGuard":null,"tryCatchPattern":"try {\n    execute(cteQuery);\n} catch (PrestoException e) {\n    if (\"NOT_SUPPORTED\".equals(e.getErrorCode().getName()) && e.getMessage().contains(\"Temporary table cannot be created\")) {\n        execute(withCteMaterializationDisabled(cteQuery)); // fallback: inline CTEs\n    } else throw e;\n}","preventionTips":["Configure cte-partitioning-provider-catalog to a writable connector (hive with write access, memory)","Test temp-table DDL in the chosen catalog during deployment","Disable CTE materialization for catalogs known to be read-only"],"tags":["planner","cte","temporary-table","connector","not-supported"],"backgroundTag":"catalog-does-not-support-temporary-tables","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"}