datalevin

Samuel Ludwig 2026-05-19T16:59:14.022759Z

I might be holding things wrong- I'm trying to understand an exception I'm getting when using missing? on a referenced entity:

(def testconn
    (d/get-conn "/tmp/datalevin/test" {:thingB/buddy {:db/valueType :db.type/ref}}))

  (d/transact! testconn [{:db/id -1, :thingA/attr "yes", :thingA/present "always"}
                         {:db/id -2, :thingB/buddy -1}
                         {:db/id -3, :thingA/present "always"}
                         {:db/id -4, :thingB/buddy -3}])

  (d/q
    '[:find ?b
      :in $
      :where
      [?b :thingB/buddy ?a]
      [(missing? $ ?a :thingA/attr)]]
    (d/db testconn))
Running the query here triggers the exception: "No implementation of method: :-search of protocol: #'datalevin.db/ISearch found for class: clojure.lang.Symbol" (this exception also happens when entities -3 and -4 are removed) The following query (not using a ref) works as expected:
(d/q
    '[:find ?a
      :in $
      :where
      [?a :thingA/present _]
      [(missing? $ ?a :thingA/attr)]]
    (d/db testconn))
However, even if ?a appears as a reference after it first occurs (as in the query below), the exception still happens
(d/q
    '[:find ?a
      :in $
      :where
      [?a :thingA/present _]
      [?b :thingB/buddy ?a]
      [(missing? $ ?a :thingA/attr)]]
    (d/db testconn))
Do I need to supply ?a differently to missing? if it's used as a reference?

Huahai 2026-05-20T04:31:09.776679Z

This seems to be a bug. Thank you for reporting.

Huahai 2026-05-20T04:50:40.985029Z

Fixed in master branch.

1