datahike

silian 2025-04-04T23:07:55.452519Z

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')

silian 2025-04-04T23:13:16.402349Z

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! : )

silian 2025-04-04T23:27:01.994409Z

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))))

silian 2025-04-04T23:40:12.383079Z

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.

silian 2025-04-04T23:54:27.274989Z

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

silian 2025-04-04T23:58:03.037889Z

For example, evaluating this expression returns error:

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

whilo 2025-04-06T08:53:07.787299Z

Which version did you use before?

whilo 2025-04-06T08:53:57.861729Z

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.

whilo 2025-04-06T08:54:11.771809Z

But is less convenient.