am i right in discovering that the tx-data grammar docs are a little off with respect to retraction? it reads (irrelevant lines omitted for brevity):
tx-data = [list-form]
list-form = (not actually specified, but i think it's implied "assertion" below in the #Assert and Retract heading)
assertion = ([op tx-entid identifier value])
tx-entid = (identifier | tempid)
• i think list-form = [op tx-entid identifier value] is wrong? i think it should read list-form = [op tx-entity attribute value]) . (there is no attribute)
• the examples given for #Assert and Retract say [op entity-id attribute value], but nowhere else is entity-id referenced in the grammar.
• i think where op = :db/retract it's actually a narrower specification: [op identifier attribute value?] where identifier is what's defined in the grammar: identifier = (eid | lookup-ref | ident). notably i dont think you can [:db/retract "tempid" attribute value?]; i think tempids are limited to :db/add?
am i reading this completely wrong? testing this locally: if i try to retract with a tempid that resolves to some entity [previously existing (or not) before this transaction executes, doesn't seem to matter], the retraction is omitted from the tx-result tx-data.I was bitten by the same thing. I tried to retract an attribute for a tempid, but am getting :db.error/not-a-keyword for the tempid.
it makes sense to me that you cant do a retract on a tempid in the case of a tx creating an entity. it doesnt really make sense to me why a tempid cannot be used to retract if that tempid is resolved to an existing entity, though. maybe the design is intentional; if an identifier might not resolve to a real entity, prevent a retract. either way the grammar not explicitly forbidding it is confusing.
I think you are right... most of the grammar examples I have seen are inconsistent. Fixing them would be a nice documentation upgrade.