tonsky / datascript

Immutable database and Datalog query engine for Clojure, ClojureScript and JS
Eclipse Public License 1.0
5.45k stars 304 forks source link

Multiple occurrences of query vars in pattern and aggregates #428

Open zoren opened 2 years ago

zoren commented 2 years ago

With this query:

(q '[:find (count ?e) .
     :with ?i
     :where [?e :r ?e ?i]]
   [[1 :r 1 10]
    [2 :r 1 11]])

I get 1 with Datomic but 2 in datascript. It appears the test for two occurrences of a query variable is tested too late.

tonsky commented 2 years ago

Looks like it. Related: #336

refset commented 1 year ago

I think this self-unification issue is related too: https://github.com/tonsky/datascript/issues/240