Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lookup ref as literal in query fails #53

Closed
sparkofreason opened this issue Jan 28, 2015 · 2 comments
Closed

Lookup ref as literal in query fails #53

sparkofreason opened this issue Jan 28, 2015 · 2 comments

Comments

@sparkofreason
Copy link

This query works:

(d/q '[:find ?e :in $ ?et :where [?e :entity/type ?et]] db [:db/ident :entity.type/survey])

This one returns an empty result:

(d/q '[:find ?e :where [?e :entity/type [:db/ident :entity.type/survey]]] db)
@tonsky
Copy link
Owner

tonsky commented Jan 28, 2015

Yep. It came from limitation of Datomic, found here:

Lookup refs cannot be used in the body of a query though they can be used as inputs in a parameterized query.

I believe it’s an implementation detail of their query parser which cannot tell the difference between function call, predicate and lookup ref (they all use list/vector form as a distinguisher).

I’ll look into it, it seems like most of the time we can tell the difference though. So I don’t see why DS shouldn’t allow this kind of syntax. Thanks for pointing that out!

@sparkofreason
Copy link
Author

Thanks for the link. Seems like they should be able to support that, at least in value position. Two main use-cases were to bridge the lack of :db/ident support, and allow sharing of the same queries between Datomic and Datascript. The latter is moot, and the former is really it's own issue, so closing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants