Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using idents as query parameters doesn't unify then #75

Open
purrgrammer opened this issue Sep 27, 2019 · 1 comment
Open

Using idents as query parameters doesn't unify then #75

purrgrammer opened this issue Sep 27, 2019 · 1 comment
Assignees
Labels
bug Something isn't working
Milestone

Comments

@purrgrammer
Copy link
Contributor

While using idents I noticed that keyword literals are unified just fine in queries. However, when passing ident keywords as arguments they are not unified. A minimal example looks like this:

(require '[datahike.api :as d])

(def uri "datahike:mem:memdb")

(def schema [{:db/ident :ident
              :db/valueType :db.type/ref
              :db/cardinality :db.cardinality/one}
             {:db/ident :an/ident}])

(d/create-database uri :initial-tx schema)

(def conn (d/connect uri))

@(d/transact! conn [[:db/add 1 :ident :an/ident]])
@(d/transact! conn [[:db/add 2 :ident :an/ident]])

(d/q '[:find ?e
       :where [?e :ident :an/ident]]
     (d/db conn))
;;=> #{[2] [1]}

(d/q '[:find ?e
       :in $ ?ident
       :where [?e :ident ?ident]]
     (d/db conn)
     :an/ident)
;;=> #{}

The above queries are equivalent, so I'd expect to get the same result from both.

@kordano
Copy link
Member

kordano commented Sep 27, 2019

Thanks. It shouldn't behave like that. I'll add a test and fix in the next patch release.

@kordano kordano self-assigned this Sep 27, 2019
@kordano kordano added the bug Something isn't working label Sep 27, 2019
@kordano kordano added this to To do in Development via automation Sep 27, 2019
@kordano kordano added this to the 0.2.1 milestone Oct 21, 2019
@whilo whilo moved this from To do to Done in Development Apr 26, 2020
@kordano kordano added this to To do in Development Jun 4, 2020
@kordano kordano moved this from To do to Backlog in Development Jun 4, 2020
@kordano kordano moved this from Next to To do in Development Jun 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: No status
Development
  
Done
Development
  
To do
Development

No branches or pull requests

2 participants