Skip to content

ne on an array attribute returns different rows on the index scan and the record filter #3951

Open

Description

@kriszyp

Problem

On an array attribute, ne returns different rows depending on which plan runs it. With sizes: [Int] @indexed, grp: Int @indexed and these records:

id sizes
1 [25, 25]
2 [25, 30]
3 [30]
4 []
5 (missing)
query result
?sizes=ne=number:25 [2, 3] — the index scan: a record with any element other than 25
?grp=1&sizes=ne=number:25 [1, 2, 3, 4, 5] — the record filter compares the whole array with 25

Reproduced on main with an explicit number: prefix, and on a programmatic { elements: { type: 'Int' } } declaration with an untyped value. After the REST condition conversion fix, the untyped form on a GraphQL [Int] attribute behaves the same way.

Results that depend on the plan are wrong either way. The adjacent array-scoping contract (resources/DESIGN.md, chained conditions) already requires indexed and unindexed paths to agree.

Expected

Pick one meaning of ne on an array attribute and apply it on both paths. One option: "no element equals the value", the negation of ==. Another: "some element differs", the index scan's current meaning. Then test it with and without a leading indexed condition, and through a to-many relationship path.

Review-Deferral: 9dc1299782bb9953 severity=minor category=correctness

🤖 Generated by Claude Opus 5.5 (Claude Code); posted via @kriszyp.

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

    Fields

    Priority

    P2

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions