From b545ddc0e1e5ce16b4b5421d76dbe2a104859cda Mon Sep 17 00:00:00 2001 From: Nick Alexander Date: Fri, 15 Jul 2016 12:42:20 -0700 Subject: [PATCH] Handle empty :where SQL clauses in query. --- src/datomish/query.cljc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/datomish/query.cljc b/src/datomish/query.cljc index 3924f09a..280632ed 100644 --- a/src/datomish/query.cljc +++ b/src/datomish/query.cljc @@ -170,11 +170,12 @@ [(map row columns-in-order) nil]))))) (defn context->sql-clause [context] - {:select (sql-projection context) - :from (:from context) - :where (if (empty? (:wheres context)) - nil - (cons :and (:wheres context)))}) + (merge + {:select (sql-projection context) + :from (:from context)} + (if (empty? (:wheres context)) + {} + {:where (cons :and (:wheres context))}))) (defn context->sql-string [context] (->