{"record":{"id":"36c73471af54b1f7","repo":"prestodb/presto","slug":"type-mismatch-36c734","errorCode":"TYPE_MISMATCH","errorMessage":"Unknown type '%s' for column '%s'","messagePattern":"Unknown type '(.+?)' for column '(.+?)'","errorType":"error_code","errorClass":"SemanticException","httpStatus":null,"severity":"error","filePath":"presto-main-base/src/main/java/com/facebook/presto/execution/CreateTableTask.java","lineNumber":133,"sourceCode":"        }\n\n        ConnectorId connectorId = getConnectorIdOrThrow(session, metadata, tableName.getCatalogName());\n\n        LinkedHashMap<String, ColumnMetadata> columns = new LinkedHashMap<>();\n        Map<String, Object> inheritedProperties = ImmutableMap.of();\n        boolean includingProperties = false;\n        List<TableConstraint<String>> constraints = new ArrayList<>();\n        for (TableElement element : statement.getElements()) {\n            if (element instanceof ColumnDefinition) {\n                ColumnDefinition column = (ColumnDefinition) element;\n                String columnName = column.getName().getValue();\n                String name = metadata.normalizeIdentifier(session, tableName.getCatalogName(), columnName);\n                Type type;\n                try {\n                    type = metadata.getType(parseTypeSignature(column.getType()));\n                }\n                catch (IllegalArgumentException | UnknownTypeException e) {\n                    throw new SemanticException(TYPE_MISMATCH, element, \"Unknown type '%s' for column '%s'\", column.getType(), column.getName());\n                }\n                if (type.equals(UNKNOWN)) {\n                    throw new SemanticException(TYPE_MISMATCH, element, \"Unknown type '%s' for column '%s'\", column.getType(), column.getName());\n                }\n                if (columns.containsKey(name)) {\n                    throw new SemanticException(DUPLICATE_COLUMN_NAME, column, \"Column name '%s' specified more than once\", column.getName());\n                }\n                if (!column.isNullable() && !metadata.getConnectorCapabilities(session, connectorId).contains(NOT_NULL_COLUMN_CONSTRAINT)) {\n                    throw new SemanticException(NOT_SUPPORTED, column, \"Catalog '%s' does not support non-null column for column name '%s'\", connectorId.getCatalogName(), column.getName());\n                }\n\n                Map<String, Expression> sqlProperties = mapFromProperties(column.getProperties());\n                Map<String, Object> columnProperties = metadata.getColumnPropertyManager().getProperties(\n                        connectorId,\n                        tableName.getCatalogName(),\n                        sqlProperties,\n                        session,\n                        metadata,","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/execution/CreateTableTask.java#L115-L151","documentation":"CreateTableTask.internalExecute throws SemanticException(TYPE_MISMATCH) when metadata.getType(parseTypeSignature(column.getType())) raises IllegalArgumentException or UnknownTypeException, meaning the declared column type string cannot be parsed or resolved to a registered type in this Presto installation.","triggerScenarios":"CREATE TABLE with a column whose type name is misspelled, connector-specific, or from a plugin that is not installed, so parseTypeSignature/metadata.getType fails.","commonSituations":"Typos in DDL (e.g. INTERGR, TIMESTAM); types only available in newer Presto versions; connector-specific types when the target catalog lacks the plugin; pasted DDL from other engines (e.g. MySQL-specific types).","solutions":["Fix the column type name to a supported Presto type (verify against SHOW TYPES / docs for your version).","Install/enable the plugin or connector that provides the custom type.","Upgrade Presto if the type exists only in newer releases.","Map the foreign-engine type to an equivalent Presto type in the DDL."],"exampleFix":"-- before\nCREATE TABLE t (id INTERGR, ts DATETIME);\n\n-- after\nCREATE TABLE t (id INTEGER, ts TIMESTAMP);","handlingStrategy":"validation","validationCode":"try {\n    Type t = metadata.getType(parseTypeSignature(column.getType()));\n    if (t == null || t.equals.UNKNOWN) {\n        throw new IllegalArgumentException(\"Unresolvable type: \" + column.getType());\n    }\n} catch (IllegalArgumentException | UnknownTypeException e) {\n    throw new IllegalStateException(\"Fix column type before DDL: \" + column.getName());\n}","typeGuard":"boolean isKnownColumnType(Metadata metadata, String typeString) {\n    try {\n        return !metadata.getType(parseTypeSignature(typeString)).equals(UNKNOWN);\n    } catch (IllegalArgumentException | UnknownTypeException e) {\n        return false;\n    }\n}","tryCatchPattern":"try {\n    createTable(session, statement, parameters);\n} catch (SemanticException e) {\n    if (e.getCode() == TYPE_MISMATCH && e.getMessage().startsWith(\"Unknown type\")) {\n        // surface the offending column/type to the caller for correction\n    } else {\n        throw e;\n    }\n}","preventionTips":["Validate column types against SHOW TYPES / metadata.getType before submitting DDL","Keep a whitelist of types supported by your Presto version and connectors","Avoid pasting DDL verbatim from other SQL engines","Pin Presto/plugin versions so type availability is deterministic"],"tags":["presto","ddl","type-mismatch","unknown-type","create-table"],"backgroundTag":"unknown-column-type","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"}