{"record":{"id":"6110944a1b81cbde","repo":"apache/cassandra","slug":"constraints-combination-of-s-is-not-supported-s","errorCode":null,"errorMessage":"Constraints combination of %s is not supported: %s %s %s, %s %s %s","messagePattern":"Constraints combination of (.+?) is not supported: (.+?) (.+?) (.+?), (.+?) (.+?) (.+?)","errorType":"validation","errorClass":"InvalidConstraintDefinitionException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/cql3/constraints/AbstractFunctionSatisfiabilityChecker.java","lineNumber":138,"sourceCode":"    private void ensureSatisfiability(ColumnMetadata columnMetadata,\n                                      String constraintName,\n                                      List<CONSTRAINT_TYPE> allConstraints)\n    {\n        if (allConstraints.size() != 2)\n            return;\n\n        Operator firstRelation = allConstraints.get(0).relationType();\n        String firstTerm = allConstraints.get(0).term();\n        Operator secondRelation = allConstraints.get(1).relationType();\n        String secondTerm = allConstraints.get(1).term();\n\n        if ((firstRelation == GT && secondRelation == GTE) ||\n            (firstRelation == GTE && secondRelation == GT) ||\n            (firstRelation == LT && secondRelation == LTE) ||\n            (firstRelation == LTE && secondRelation == LT) ||\n            (firstRelation == EQ || secondRelation == EQ))\n        {\n            throw new InvalidConstraintDefinitionException(format(\"Constraints combination of %s is not supported: %s %s %s, %s %s %s\",\n                                                                  constraintName,\n                                                                  columnMetadata.name,\n                                                                  firstRelation,\n                                                                  firstTerm,\n                                                                  columnMetadata.name,\n                                                                  secondRelation,\n                                                                  secondTerm));\n        }\n        else if (firstRelation == NEQ && secondRelation == NEQ)\n        {\n            if (firstTerm.equals(secondTerm))\n                throw new InvalidConstraintDefinitionException(format(\"There are duplicate constraint definitions on column '%s'.\", columnMetadata.name));\n        }\n        else\n        {\n            AbstractType<?> returnType = returnType(columnMetadata);\n            ByteBuffer firstTermBuffer = returnType.fromString(ParseUtils.unquote(firstTerm));\n            ByteBuffer secondTermBuffer = returnType.fromString(ParseUtils.unquote(secondTerm));","sourceCodeStart":120,"sourceCodeEnd":156,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/cql3/constraints/AbstractFunctionSatisfiabilityChecker.java#L120-L156","documentation":"ensureSatisfiability checks pairs of constraints on a column for logically impossible or redundant combinations. Combinations like GT+GTE, LT+LTE, or any pair involving EQ are rejected outright because they cannot (or trivially do) constrain anything meaningful; the exception lists the constraint name, column, both relations and terms.","triggerScenarios":"CREATE TABLE/ALTER TABLE declaring two constraints on one column where one is EQ, or where relations are GT&GTE or LT&LTE against each other.","commonSituations":"Writing redundant bounds (x > 5 AND x >= 5); accidentally specifying both an equality and a range on the same column; translating RDBMS CHECK semantics that Cassandra rejects.","solutions":["Remove the redundant constraint of each rejected pair (e.g. drop the GT when GTE is present).","Replace EQ+range combos with a single equality constraint only.","Merge the two relations into a single well-formed range constraint."],"exampleFix":"// before\nCREATE TABLE t (x int CHECK x > 5 AND x >= 5);\n// after\nCREATE TABLE t (x int CHECK x >= 5);","handlingStrategy":"validation","validationCode":"if (first == Operator.EQ || second == Operator.EQ) throw new IllegalArgumentException(\"EQ cannot be combined with another constraint\");\nif ((first == Operator.GT && second == Operator.GTE) || (first == Operator.GTE && second == Operator.GT)\n || (first == Operator.LT && second == Operator.LTE) || (first == Operator.LTE && second == Operator.LT))\n    throw new IllegalArgumentException(\"Redundant constraint pair\");","typeGuard":null,"tryCatchPattern":"try {\n    session.execute(schemaDdl);\n} catch (InvalidRequestException e) {\n    if (e.getMessage().contains(\"Constraints combination\")) {\n        log.error(\"Remove redundant/conflicting constraint pair: {}\", e.getMessage());\n    } else throw e;\n}","preventionTips":["Express each column's bounds as one minimal pair of constraints","Lint generated DDL for redundant relations","Prefer >= / <= over mixed >/>= pairs"],"tags":["cassandra","cql","constraints","satisfiability"],"backgroundTag":"conflicting-config-options","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"}