Skip to content

Postgraphile V5 - Filtering by nested relations not working when filter value is undefiend #208

Open
@scottravio

Description

Version: 3.0.0-beta.2

When filtering by a related table field, the plugin works when the filter value is defined. When the filter value is undefined the filter plugin seems to filter out rows where the related table row is null.

For example given a query like:

query Query($departmentId: UUID) {
   users(
      filter : {
         jobTitleToDepartment: {
             department: { id: { equalTo: $departmentId }}
         }
      }
   ) {
       nodes {
           id
       }
    }
}

This works as long as the department relation exists. If querying for a user with a job title that does not have a department, no rows are returned when the $departmentId variable is undefined. Expected behaviour is to ignore the filter with the filter value is undefined

The jobTitleToDepartment relation is a virtual constraint created with the @foreignKey smart tag

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions