mozilla / mentat

UNMAINTAINED A persistent, relational store inspired by Datomic and DataScript.
https://mozilla.github.io/mentat/
Apache License 2.0
1.65k stars 115 forks source link

[query] Don't allow ordering by things that Mentat considers incomparable #751

Open ncalexan opened 6 years ago

ncalexan commented 6 years ago

Right now, we don't allow comparing refs:

mentat=> .q [:find ?v :where [?e ?a ?v] [(> ?e 10)]]
Error(MentatError(QueryError(InvalidArgumentType(PlainSymbol(">"), ValueTypeSet({Instant, Long, Double}), 0))), State { next_error: None, backtrace: None }).

But we do accept ordering by ref:

mentat=> .q [:find ?v :where [?e ?a ?v] :order ?e :limit 2]
| ?v         |
---
| :db/ident  |
| 24         |
---

This ticket tracks being consistent.

A harder problem is to track entities that we know are transactions, and to allow comparing and ordering those transactions refs.

rnewman commented 6 years ago

I thought I had a branch for that…

rnewman commented 6 years ago

Search for TxAfter, and see discussion in the PR that added it.