{"record":{"id":"a20b0762c979fbb0","repo":"prestodb/presto","slug":"not-supported-a20b07","errorCode":"NOT_SUPPORTED","errorMessage":"Constraint %s of unknown type is not supported","messagePattern":"Constraint (.+?) of unknown type is not supported","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-hive-metastore/src/main/java/com/facebook/presto/hive/metastore/thrift/ThriftHiveMetastore.java","lineNumber":1066,"sourceCode":"                                        constraint.isEnabled(),\n                                        constraint.isEnforced(),\n                                        constraint.isRely()));\n                    }\n                }\n                else if (constraint instanceof NotNullConstraint) {\n                    notNullConstraints.add(\n                            new SQLNotNullConstraint(\n                                    table.getCatName(),\n                                    table.getDbName(),\n                                    table.getTableName(),\n                                    constraint.getColumns().stream().findFirst().get(),\n                                    constraint.getName().orElse(null),\n                                    constraint.isEnabled(),\n                                    constraint.isEnforced(),\n                                    constraint.isRely()));\n                }\n                else {\n                    throw new PrestoException(NOT_SUPPORTED, format(\"Constraint %s of unknown type is not supported\", constraint.getName().orElse(\"\")));\n                }\n            }\n\n            callableName = \"createTableWithConstraints\";\n            apiStats = stats.getCreateTableWithConstraints();\n            callableClient = apiStats.wrap(() ->\n                    getMetastoreClientThenCall(metastoreContext, client -> {\n                        client.createTableWithConstraints(table, primaryKeys, uniqueConstraints, notNullConstraints);\n                        return null;\n                    }));\n        }\n\n        try {\n            retry()\n                    .stopOn(AlreadyExistsException.class, InvalidObjectException.class, MetaException.class, NoSuchObjectException.class)\n                    .stopOnIllegalExceptions()\n                    .run(callableName, callableClient);\n        }","sourceCodeStart":1048,"sourceCodeEnd":1084,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-hive-metastore/src/main/java/com/facebook/presto/hive/metastore/thrift/ThriftHiveMetastore.java#L1048-L1084","documentation":"When creating a table with constraints, ThriftHiveMetastore converts Presto logical constraints into Hive table constraints. Only PRIMARY KEY, UNIQUE, CHECK (and foreign keys handled in the preceding branch) are supported; any other constraint type triggers this NOT_SUPPORTED PrestoException.","triggerScenarios":"CREATE TABLE ... (with constraints) where a constraint object in the table metadata is not PRIMARY KEY/UNIQUE/CHECK/FOREIGN KEY — e.g. a novel or connector-specific constraint type reaching the Hive metadata layer.","commonSituations":"CTAS or CREATE TABLE LIKE from another connector that carries unsupported constraint kinds; tooling-generated DDL including exotic constraints; connector/plugin version mismatch injecting new constraint types.","solutions":["Remove the unsupported constraint from the CREATE TABLE statement","Create the table without constraints and enforce rules at the application/query level","Check connector/plugin versions for consistency so only known constraint kinds are produced","If needed, express the constraint as a supported type (PRIMARY KEY/UNIQUE/CHECK)"],"exampleFix":"-- before\nCREATE TABLE hive.db.t (a BIGINT, CONSTRAINT c0 EXCLUDE ...);\n-- after: drop unsupported constraint\nCREATE TABLE hive.db.t (a BIGINT);\n","handlingStrategy":"validation","validationCode":"// validate constraint types before CREATE TABLE with constraints\nboolean supported = constraints.stream().allMatch(c ->\n    c instanceof PrimaryKey || c instanceof Unique || c instanceof Check || c instanceof ForeignKey);\nif (!supported) { /* strip or rewrite unsupported constraints */ }","typeGuard":null,"tryCatchPattern":"try {\n    createTable(...);\n} catch (PrestoException e) {\n    if (\"NOT_SUPPORTED\".equals(e.getErrorCode().getName())\n            && e.getMessage().contains(\"of unknown type\")) {\n        // retry without constraints\n    } else throw e;\n}","preventionTips":["Only use PRIMARY KEY/UNIQUE/CHECK/FOREIGN KEY constraints in Hive DDL","Strip connector-specific constraints when migrating tables into Hive","Keep connector versions aligned across the cluster","Document constraint limitations in your DDL templates"],"tags":["hive","ddl","constraint","not-supported"],"backgroundTag":"unsupported-constraint-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"}