Fork me on GitHub
#datalevin
<
2022-05-10
>
Huahai16:05:34

0.6.9 is released, with two fixes and added a set of utility functions to customize search Thanks to @brownjoshua490 and @nils.grunwald

🎉 6
vlad_poh19:05:26

Hi All! The following throws an error and i'm not sure why. I do have a work around but just curious why that happens

(def conn (d/get-conn "./demo" schema))
(d/update-schema conn {:xid {:db/cardinality :db.cardinality/one
                             :db/valueType :db.type/long
                             :db/unique    :db.unique/identity}})
(d/transact! conn [{:xid 2 :word "one"}])   
;=> {:datoms-transacted 2}
(d/transact! conn [{:xid 2 :word "one"}])   
;=> {:datoms-transacted 0}
(d/transact! conn [{:xid 3.0 :word "one"}]) 
;=> {:datoms-transacted 2}
(d/transact! conn [{:xid 3.0 :word "one"}]) 
;=>clojure.lang.ExceptionInfo: Unable to write transit:"java.lang.Exception: Not supported: class datalevin.datom.Datom" {:value {:error :transact/unique, :attribute :xid, :datom #datalevin/Datom [73 :xid 3.0], :type "class clojure.lang.ExceptionInfo"}}
My work around is to do the following
(d/transact! conn [(update-in {:xid 3.0 :word "one"} [:xid] long)])   

Huahai19:05:14

Is this in pods?

Huahai19:05:19

you are transacting double for a value declared as long, it should error out, right?

vlad_poh19:05:12

exactly so why does it work the first time? In pods it errors out and kills the session in lein I get a datalevin transaction error and continues

Huahai19:05:41

we don’t actually check the data types, so it works the first time, but the second time it does check, as the transaction has to read the existing value, then it found there’s a problem

vlad_poh19:05:01

ah! that makes sense

Huahai19:05:15

it could be an option to turn on data type checks in the future

Huahai19:05:42

not as default though, as it does slow things done

vlad_poh19:05:10

very true. Thanks for your prompt response as always.

Huahai19:05:43

filed an issue

👍 1
🙏 1