{"record":{"id":"2b722fddac281122","repo":"hasura/graphql-engine","slug":"column-column-name-is-not-defined-in-function-pr","errorCode":null,"errorMessage":"column {column_name} is not defined in function/procedure {func_proc_name} in data connector {db_name}","messagePattern":"column (.+?) is not defined in function/procedure (.+?) in data connector (.+?)","errorType":"validation","errorClass":"NDCValidationError","httpStatus":null,"severity":"error","filePath":"v3/crates/metadata-resolve/src/helpers/ndc_validation.rs","lineNumber":65,"sourceCode":"        db_name: Qualified<DataConnectorName>,\n        model_name: Qualified<ModelName>,\n        field_name: FieldName,\n        collection_name: CollectionName,\n        column_name: DataConnectorColumnName,\n    },\n    #[error(\"procedure {procedure_name} is not defined in data connector {db_name}\")]\n    NoSuchProcedure {\n        db_name: Qualified<DataConnectorName>,\n        command_name: Qualified<CommandName>,\n        procedure_name: ProcedureName,\n    },\n    #[error(\"function {function_name} is not defined in data connector {db_name}\")]\n    NoSuchFunction {\n        db_name: Qualified<DataConnectorName>,\n        command_name: Qualified<CommandName>,\n        function_name: FunctionName,\n    },\n    #[error(\n        \"column {column_name} is not defined in function/procedure {func_proc_name} in data connector {db_name}\"\n    )]\n    NoSuchColumnForCommand {\n        db_name: Qualified<DataConnectorName>,\n        command_name: Qualified<CommandName>,\n        field_name: FieldName,\n        func_proc_name: String,\n        column_name: DataConnectorColumnName,\n    },\n    #[error(\n        \"column {column_name} has type {column_type} in collection {collection_name} in data connector {db_name}, not type {field_type}\"\n    )]\n    ColumnTypeDoesNotMatch {\n        db_name: DataConnectorName,\n        model_name: ModelName,\n        field_name: FieldName,\n        collection_name: CollectionName,\n        column_name: DataConnectorColumnName,","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/metadata-resolve/src/helpers/ndc_validation.rs#L47-L83","documentation":"A function/procedure command's field mapping or result shape references a column that the connector's function/procedure does not declare. The resolver validates that every column used in argument/result mappings of a command exists on the underlying NDC function or procedure.","triggerScenarios":"Adding a mapped field/column in a command's output type that is not among the columns returned by the configured function or procedure; changing the function's return columns without updating command metadata.","commonSituations":"SELECT list of a database function changed; column renamed; copy-pasting command metadata and forgetting to update column mappings; stale connector schema.","solutions":["Check the function/procedure's actual output columns in the connector schema and fix the field mapping in the command definition","If the column was renamed in the database, update the metadata to use the new column name","Refresh the connector's schema so the resolver sees current columns"],"exampleFix":"# before\noutput_type:\n  type: object\n  fields:\n    user_email: { column: usr_email }  # column not returned by function\n# after\noutput_type:\n  type: object\n  fields:\n    user_email: { column: user_email }","handlingStrategy":"validation","validationCode":"let cols: HashSet<_> = ndc_function.returns.columns();\nassert!(cols.contains(&expected_column));","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate command field mappings against the function/procedure return columns before applying metadata"],"tags":["ndc","command","column","function","procedure"],"backgroundTag":"ndc-column-not-found","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}