Skip to content

[Bug] where: { and: [...], or: [...] } builds the wrong filter #6809

Backlog

Description

@cargopete

Bug report

In build_filter_from_object (graphql/src/store/query.rs:285 and :296), the And and Or arms pass the whole parent object to build_list_filter_from_object instead of this key's value, and that function flattens every key's list into one.

musicians(where: { and: [{ name: "A1" }, { email: "A2" }], or: [{ name: "B1" }, { email: "B2" }] })

builds And([And([A1, A2, B1, B2]), Or([A1, A2, B1, B2])]), so rows matching only one or branch are silently dropped.

Same cause: { _change_block: { number_gte: 10 }, or: [...] } is explicitly allowed by the check above, but then errors with InvalidFilterError because _change_block's value isn't a list.

Fix is to build the list from value (build_list_filter_from_value). Confirmed with a unit test on build_query on master (693bfb0).

Some information to help us out

  • Tick this box if this bug is caused by a regression found in the latest release.
  • Tick this box if this bug is specific to the hosted service.
  • I have searched the issue tracker to make sure this issue is not a duplicate.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

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