Currently, in the main branch, this is not possible and results in an exception being thrown. The fundamental issue is that a part of the code in transact.cljc tries to convert keywords that are system keywords to their database ids. It tries to do this mapping no matter the value type of the attribute of the datom being transacted. For example, if the value type is a keyword that just happens to have the same name as a system attribute, it will still attempt to map, which is wrong. And this specifically fails for :db/id which is not an attribute in the database but is a system keyword. The line that fixes this issue is (dbu/is-attr? db straight-a-ident :db/systemAttribRef) in transaction.cljc which will make sure that we only attempt this mapping to database ids if the value type of the attribute is a type that makes sense to map.
Checks
Bugfix
[x] Related issues linked using fixes #number
[x] Integration tests added
[ ] Architecture Decision Record added if design changes necessary
SUMMARY
Fixes #678
The code in this PR makes it possible to run the following transactions against an empty database with attribute-refs turned on:
Currently, in the main branch, this is not possible and results in an exception being thrown. The fundamental issue is that a part of the code in
transact.cljc
tries to convert keywords that are system keywords to their database ids. It tries to do this mapping no matter the value type of the attribute of the datom being transacted. For example, if the value type is a keyword that just happens to have the same name as a system attribute, it will still attempt to map, which is wrong. And this specifically fails for:db/id
which is not an attribute in the database but is a system keyword. The line that fixes this issue is(dbu/is-attr? db straight-a-ident :db/systemAttribRef)
intransaction.cljc
which will make sure that we only attempt this mapping to database ids if the value type of the attribute is a type that makes sense to map.Checks
Bugfix
fixes #number