Discussion:
Using a string tempid with :db.fn/cas does not work
Gijs S.
2016-12-28 18:21:50 UTC
Permalink
Hi,

With [com.datomic/datomic-pro "0.9.5544"];

Using a string tempid with :db.fn/cas does not work.

With schema:
[{:db/ident :article/slug
:db/valueType :db.type/string
;; identity to enable upsert
:db/unique :db.unique/identity
:db/cardinality :db.cardinality/one}
{:db/ident :article/rev
:db/valueType :db.type/long
:db/cardinality :db.cardinality/one}]


(let [slug "unique_slug"
base-rev nil
next-rev 1

;; with tempid id works
tempid (d/tempid :db.part/user -1)
tx @(d/transact conn
[[:db/add tempid :article/slug slug]
[:db.fn/cas tempid :article/rev base-rev next-rev]])

;; with string-tempid does not work
string-tempid "STRINGID"
tx-two @(d/transact conn
[[:db/add string-tempid :article/slug slug]
[:db.fn/cas string-tempid :article/rev base-rev
next-rev]])
;; IllegalArgumentExceptionInfo :db.error/not-a-keyword Cannot interpret as
a keyword:
;; STRINGID, no leading : datomic.error/deserialize-exception
(error.clj:124)
])

Using this combination of upsert, :db.fn/cas and string tempids also
does not work when using datomic client ([com.datomic/clj-client
"0.8.606"]). And in datomic client there is no alternative to string
tempids.
--
You received this message because you are subscribed to the Google Groups "Datomic" group.
To unsubscribe from this group and stop receiving emails from it, send an email to datomic+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Gijs S.
2016-12-28 19:29:13 UTC
Permalink
Turns out that that I don't need the combination of
:db.unique/identity and :db.fn/cas. Using :db.unique/value is the
better fit for my use case.

Perhaps :db.dn/cas and tempids are never needed together at all.
--
You received this message because you are subscribed to the Google Groups "Datomic" group.
To unsubscribe from this group and stop receiving emails from it, send an email to datomic+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Camille Troillard
2017-04-19 16:04:14 UTC
Permalink
Hi,

I stumbled upon this problem too:
Using a combination of string tempids, :db.unique/identity and :db.fn/cas
does not work, except when using a regular tempid.

It is possible to have the confirmation that this is a bug or not?
I don't see in the documentation what would prevent this use case.


Best,
Cam
Post by Gijs S.
Turns out that that I don't need the combination of
:db.unique/identity and :db.fn/cas. Using :db.unique/value is the
better fit for my use case.
Perhaps :db.dn/cas and tempids are never needed together at all.
--
You received this message because you are subscribed to the Google Groups "Datomic" group.
To unsubscribe from this group and stop receiving emails from it, send an email to datomic+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Val W
2017-04-19 18:02:49 UTC
Permalink
While the error message is not very helpful, the fact it doesn't work
should come as no surprise, as database functions are executed prior to
tempid resolution.

Val
Post by Camille Troillard
Hi,
Using a combination of string tempids, :db.unique/identity and :db.fn/cas
does not work, except when using a regular tempid.
It is possible to have the confirmation that this is a bug or not?
I don't see in the documentation what would prevent this use case.
Best,
Cam
Post by Gijs S.
Turns out that that I don't need the combination of
:db.unique/identity and :db.fn/cas. Using :db.unique/value is the
better fit for my use case.
Perhaps :db.dn/cas and tempids are never needed together at all.
--
You received this message because you are subscribed to the Google Groups "Datomic" group.
To unsubscribe from this group and stop receiving emails from it, send an email to datomic+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...