datahike 2025-04-04

Getting new errors when attempting to export-db:

; Execution error (ClassCastException) at datahike.datom/cmp-temporal-datoms-eavt-quick (datom.cljc:305).
; class clojure.lang.PersistentList cannot be cast to class java.lang.Comparable (clojure.lang.PersistentList is in unnamed module of loader 'app'; java.lang.Comparable is in module java.base of loader 'bootstrap')

Although I dislike upgrading to newer releases when errors occur, I will do so now. (I hate having to restart the REPL -- kills the flow but having to build everything from scratch would be real flow killer! : )

The devious fn in question:

(defn cmp-temporal-datoms-eavt-quick [^Datom d1, ^Datom d2]
  (combine-cmp
   (#?(:clj Long/compare :cljs -) (.-e d1) (.-e d2))
   (cmp-attr-quick (.-a d1) (.-a d2))
   (compare (.-v d1) (.-v d2))
   (#?(:clj Long/compare :cljs -) (datom-tx d1) (datom-tx d2))
   (#?(:clj Boolean/compare :cljs -) (datom-added d1) (datom-added d2))))

With help of chatGPT, I think I understand what's happening ... one of the entities in my db has a value which is a list of strings.

Hmm, simply trying to retract troublesome entity yields same compare error.

For example, evaluating this expression returns error:

(d/transact conn [{:db/id  31
                 :listing/images2 "I am not permitted to do this"}])

Which version did you use before?

I think it is possible with schema on read to transact nested data structures, maybe this is the problem here. Schema on write prohibits this in general.

But is less convenient.