summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/clojure_sql/dsl.clj7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/clojure_sql/dsl.clj b/src/clojure_sql/dsl.clj
index 8264e24..015dfda 100644
--- a/src/clojure_sql/dsl.clj
+++ b/src/clojure_sql/dsl.clj
@@ -85,9 +85,10 @@
"Create a query on a database table. If `table` is itself a query it
will be wrapped, otherwise `table` will be used as the table name."
[table]
- (q/map->Query (let [name (if (u/named? table) table "table")]
- {:tables {name table}
- :joins [name]})))
+ (q/map->Query (let [table-name (if (u/named? table) (name table) "table")
+ table-keyword (keyword (gensym table-name))]
+ {:tables {table-keyword table}
+ :joins [table-keyword]})))
(defn ^:private into-map-duplicate-error [coll error-fn]
(reduce (fn [acc [k v]]