This commit is contained in:
Sean Corfield 2021-12-21 22:54:02 -08:00
parent fa0bb6830c
commit b30aa0f3f9
3 changed files with 9 additions and 2 deletions

View file

@ -1,6 +1,7 @@
# Changes # Changes
* 2.1.next in progress * 2.1.next in progress
* Fix #375 for `:nest` statement.
* Update test dependencies. * Update test dependencies.
* Update `build-clj` to v0.6.1. * Update `build-clj` to v0.6.1.

View file

@ -201,6 +201,12 @@ level of parentheses around it:
`:nest` is also supported as a SQL clause for the same reason. `:nest` is also supported as a SQL clause for the same reason.
```clojure
;; BigQuery requires UNION clauses be parenthesized:
(sql/format {:union-all [{:nest {:select :*}} {:nest {:select :*}}]})
;;=> ["(SELECT *) UNION ALL (SELECT *)"]
```
## not ## not
Accepts a single expression and formats it with `NOT` Accepts a single expression and formats it with `NOT`

View file

@ -875,8 +875,8 @@
:refresh-materialized-view (fn [_ x] (format-create :refresh :materialized-view x nil)) :refresh-materialized-view (fn [_ x] (format-create :refresh :materialized-view x nil))
:raw (fn [_ x] (raw-render x)) :raw (fn [_ x] (raw-render x))
:nest (fn [_ x] :nest (fn [_ x]
(let [[sql & params] (format-expr x)] (let [[sql & params] (format-dsl x {:nested true})]
(into [(str "(" sql ")")] params))) (into [sql] params)))
:with #'format-with :with #'format-with
:with-recursive #'format-with :with-recursive #'format-with
:intersect #'format-on-set-op :intersect #'format-on-set-op