{"record":{"id":"95033b7005c0bb30","repo":"apache/cassandra","slug":"s-constraint-of-relation-s-is-not-supported-o","errorCode":null,"errorMessage":"%s constraint of relation '%s' is not supported. Only these are: %s","messagePattern":"(.+?) constraint of relation '(.+?)' is not supported\\. Only these are: (.+?)","errorType":"validation","errorClass":"InvalidConstraintDefinitionException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/cql3/constraints/AbstractFunctionSatisfiabilityChecker.java","lineNumber":82,"sourceCode":"    /**\n     * Categorizes given constraints into two lists. The first list, the left one in Pair, contains all\n     * constraints of implementation-specific {@link org.apache.cassandra.cql3.constraints.ColumnConstraint.ConstraintType}.\n     * The second list, the right one in Pair, contains all constraints of such constraint type which do have \"not equal\" operator.\n     *\n     * @param constraints  constraints to categorize\n     * @param functionName name of function\n     * @return pair of categorized constraints\n     */\n    abstract Pair<List<CONSTRAINT_TYPE>, List<CONSTRAINT_TYPE>> categorizeConstraints(List<ColumnConstraint<?>> constraints, String functionName);\n\n    abstract AbstractType<?> returnType(ColumnMetadata columnMetadata);\n\n    private void checkSupportedOperators(List<CONSTRAINT_TYPE> allConstraints, String functionName)\n    {\n        for (CONSTRAINT_TYPE constraint : allConstraints)\n        {\n            if (!constraint.getSupportedOperators().contains(constraint.relationType()))\n                throw new InvalidConstraintDefinitionException(format(\"%s constraint of relation '%s' is not supported. Only these are: %s\",\n                                                                      functionName,\n                                                                      constraint.relationType(),\n                                                                      constraint.getSupportedOperators()));\n        }\n    }\n\n    /**\n     * Checks if there are no duplicate constraints having same operator.\n     *\n     * @param columnMetadata      medata of a column\n     * @param filteredConstraints pair of all constraints and all constraints having not-equal operator\n     */\n    private void checkNumberOfConstraints(ColumnMetadata columnMetadata, Pair<List<CONSTRAINT_TYPE>, List<CONSTRAINT_TYPE>> filteredConstraints)\n    {\n        List<? extends AbstractFunctionConstraint<CONSTRAINT_TYPE>> allConstraints = filteredConstraints.left;\n        List<? extends AbstractFunctionConstraint<CONSTRAINT_TYPE>> notEqualConstraints = filteredConstraints.right;\n\n        if ((allConstraints.size() - notEqualConstraints.size() > 2))","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/cql3/constraints/AbstractFunctionSatisfiabilityChecker.java#L64-L100","documentation":"When defining a column constraint (CREATE TABLE ... CHECK), each constraint supports only a fixed set of relational operators returned by getSupportedOperators(). If the relationType used in the definition is not among them, checkSupportedOperators throws InvalidConstraintDefinitionException listing the allowed operators. This happens at schema-validation time (check), before the constraint is stored.","triggerScenarios":"CREATE TABLE / ALTER TABLE with a CHECK constraint using an unsupported operator for the constraint function, e.g. an equality-style relation on a constraint that only supports GT/LT comparisons.","commonSituations":"Typing the wrong operator in a CHECK clause; copying constraint syntax between constraint function families (e.g. length vs scalar constraints) with different operator sets; version differences in supported operators.","solutions":["Rewrite the constraint to use one of the operators listed in the exception message.","Check the documentation for the specific constraint function's supported operators.","If an operator seems legitimately needed, implement/extend getSupportedOperators() for that constraint type in a custom patch."],"exampleFix":"// before\nCREATE TABLE t (age int CHECK age = 18); // unsupported operator\n// after\nCREATE TABLE t (age int CHECK age >= 18);","handlingStrategy":"validation","validationCode":"Set<Operator> supported = constraint.getSupportedOperators();\nif (!supported.contains(relationType))\n    throw new IllegalArgumentException(\"Operator \" + relationType + \" not supported; allowed: \" + supported);","typeGuard":null,"tryCatchPattern":"try {\n    session.execute(schemaDdl);\n} catch (InvalidRequestException e) {\n    if (e.getMessage().contains(\"is not supported. Only these are:\")) {\n        log.error(\"Fix CHECK operator in DDL: {}\", e.getMessage());\n    } else throw e;\n}","preventionTips":["Consult per-constraint-function operator docs before writing CHECK clauses","Centralize DDL generation so operators are validated once","Test schema DDL in a dev cluster before production rollout"],"tags":["cassandra","cql","constraints","schema-definition"],"backgroundTag":"unsupported-operation","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}