From fbd8c0bfbb8f642fc00cecd7429b37b8517750c0 Mon Sep 17 00:00:00 2001 From: Richard Newman Date: Wed, 20 Jul 2016 14:25:24 -0700 Subject: [PATCH] Always SELECT DISTINCT. --- src/datomish/query.cljc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/datomish/query.cljc b/src/datomish/query.cljc index c0e0ba81..23adcbca 100644 --- a/src/datomish/query.cljc +++ b/src/datomish/query.cljc @@ -23,7 +23,12 @@ (defn context->sql-clause [context] (merge - {:select (projection/sql-projection context)} + {:select (projection/sql-projection context) + + ;; Always SELECT DISTINCT, because Datalog is set-based. + ;; TODO: determine from schema analysis whether we can avoid + ;; the need to do this. + :modifiers [:distinct]} (clauses/cc->partial-subquery (:cc context)))) (defn context->sql-string [context]