{"record":{"id":"3db710804ddbc265","repo":"hasura/graphql-engine","slug":"the-comparable-relationship-relationship-name-3db710","errorCode":null,"errorMessage":"the comparable relationship '{relationship_name}' for the operand type '{operand_type}' is an array relationship. This is not supported","messagePattern":"the comparable relationship '(.+?)' for the operand type '(.+?)' is an array relationship\\. This is not supported","errorType":"validation","errorClass":"AggregateBooleanExpressionError","httpStatus":null,"severity":"error","filePath":"v3/crates/metadata-resolve/src/stages/aggregate_boolean_expressions/types.rs","lineNumber":311,"sourceCode":"    },\n\n    #[error(\n        \"the comparable relationship '{relationship_name}' was not found for the operand type '{operand_type}'\"\n    )]\n    ComparableRelationshipNotFound {\n        operand_type: Qualified<CustomTypeName>,\n        relationship_name: RelationshipName,\n    },\n\n    #[error(\n        \"the comparable relationship '{relationship_name}' for the operand type '{operand_type}' targets a command. This is not supported\"\n    )]\n    ComparableRelationshipCommandTargetNotSupported {\n        operand_type: Qualified<CustomTypeName>,\n        relationship_name: RelationshipName,\n    },\n\n    #[error(\n        \"the comparable relationship '{relationship_name}' for the operand type '{operand_type}' is an array relationship. This is not supported\"\n    )]\n    ComparableArrayRelationshipNotSupported {\n        operand_type: Qualified<CustomTypeName>,\n        relationship_name: RelationshipName,\n    },\n\n    #[error(\n        \"the comparable relationship '{relationship_name}' for the operand type '{operand_type}' targets a model than cannot be found: '{target_model_name}'\"\n    )]\n    ComparableRelationshipTargetModelNotFound {\n        operand_type: Qualified<CustomTypeName>,\n        relationship_name: open_dds::relationships::RelationshipName,\n        target_model_name: Qualified<open_dds::models::ModelName>,\n    },\n\n    #[error(\n        \"the comparable relationship '{relationship_name}' for the operand type '{operand_type}' references a boolean expression type that cannot be found: '{boolean_expression_type}'\"","sourceCodeStart":293,"sourceCodeEnd":329,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/metadata-resolve/src/stages/aggregate_boolean_expressions/types.rs#L293-L329","documentation":"Comparable relationships must be object (single) relationships; array relationships are rejected because nested aggregate boolean expressions over array relationships are not supported by this stage.","triggerScenarios":"Marking an array (many) relationship as a comparable relationship for aggregate boolean expressions.","commonSituations":"Trying to filter parents by aggregates of their children (e.g. authors where their articles' avg rating > x) by marking the articles array relationship as comparable, which this feature does not support; misunderstanding which relationship kinds allow nested aggregation.","solutions":["Remove the array relationship from comparableRelationships","Restructure the metadata so aggregation goes through an object relationship to a type that models the child collection","Filter on the child side or via a dedicated aggregate model/relationship instead"],"exampleFix":"# before\n# Author --articles--> [Article] (array relationship)\ncomparableRelationships:\n  - relationshipName: articles\n\n# after\ncomparableRelationships:\n  - relationshipName: profile   # object relationship only\n# query aggregates on Article directly: article_aggregate(where: {rating: {_gt: 4}})","handlingStrategy":"validation","validationCode":"for r in &comparable_relationships {\n    let rel = operand_type.relationships[&r.relationship_name];\n    assert!(!rel.is_array(), \"array relationship cannot be comparable\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Remember nested aggregate bool exp only supports object relationships","Model child-side filtering instead of parent-side aggregation over arrays"],"tags":["rust","hasura","metadata","array-relationship","aggregation"],"backgroundTag":"unsupported-relationship-target","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}