8000 or whose variables no earlier clause binds returns no rows · Issue #610 · project-minigraf/minigraf · GitHub
[go: up one dir, main page]

Skip to content

or whose variables no earlier clause binds returns no rows #610

Closed

Description

@adityamukho

Found while fixing #608 (PR #609).

Repro

(transact [[:a :edge :b] [:b :edge :c]])

(query [:find ?p :where (or [?p :edge :b] [?p :edge :c])])
; ok: 2 rows (:a, :b)

(query [:find ?x ?p :where [?x :edge ?z] (or [?p :edge :b] [?p :edge :c])])
; No results — expected 4 rows (?x ∈ {:a, :b} × ?p ∈ {:a, :b})

(query [:find ?x ?p :where [?x :edge ?z] (or-join [?p] [?p :edge :b] [?p :edge :c])])
; INT-018 "join variable ?p in (or-join ...) is not bound by any earlier clause"

An or placed after other clauses, whose branch variables none of those clauses bind, returns no rows. It should join as a cross product. It only uses patterns, so rules and magic sets are not involved. The same or on its own works.

or-join refuses the same shape with INT-018. So or silently returns an empty answer where or-join reports an error. One of the two needs to change: either or evaluates the shape, or it is refused the same way.

The same result on main (28f4a4e) and v3 (e078e46).

Activity

  1. added this to the v3.0.0 milestone on Oct 16, 2026
  2. adityamukho commented on Oct 16, 2026

    @adityamukho
    CollaboratorAuthor

    Fixed on v3 by #612 (8e1f771) and backported to main by #613 (c21168f, ships in the next v2.0.x patch). An or sharing no variable with the earlier clauses now joins as a cross product; or-join keeps INT-018, since it filters rather than binds.

  3. added a commit that references this issue on Oct 16, 2026
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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0