:as is ignored for :db/id in pull expressions

If to execute the next query:

(d/q '[:find
 [(pull ?User [[:db/id :as "id2"][:User/bigDec :as "bigDec2"]]) ...]
 :in
 $
 :where

 [?User :User/bigDec _]
]
(d/db conn))

then the result is:

[{:db/id 17592186045418, "bigDec2" 3.02M} {:db/id 17592186045421, "bigDec2" 3.020M} {:db/id 17592186045423, "bigDec2" 3.020M}]

We see that maps contain :db/id instead of “id2”, is it expected result or I’m doing something wrong? Thanks

3 Likes

Hi @nikolayandr, db/id is special, but I see how this is inconsistent behavior and we either need to adjust this behavior to allow for aliasing or specify in the docs that db/id can not be aliased. I need to discuss this issue with the team and confirm what the correct course here is. I’ll update you as we’ve had a chance to review.

2 Likes