on-conflict needs ( ) around exprs
This commit is contained in:
parent
290537c581
commit
e7972ac1b4
2 changed files with 4 additions and 5 deletions
|
|
@ -889,11 +889,10 @@
|
||||||
{:clause x})))
|
{:clause x})))
|
||||||
[sqls expr-params]
|
[sqls expr-params]
|
||||||
(when (seq exprs)
|
(when (seq exprs)
|
||||||
(format-expr-list exprs))
|
(format-expr-list (map (fn [e] (if (sequential? e) [:nest e] e)) exprs)))
|
||||||
[sql & clause-params]
|
[sql & clause-params]
|
||||||
(when clause
|
(when clause
|
||||||
(format-dsl clause))]
|
(format-dsl clause))]
|
||||||
|
|
||||||
(-> [(str (sql-kw k)
|
(-> [(str (sql-kw k)
|
||||||
(when (pos? n)
|
(when (pos? n)
|
||||||
(str " (" (str/join ", " sqls) ")"))
|
(str " (" (str/join ", " sqls) ")"))
|
||||||
|
|
|
||||||
|
|
@ -772,13 +772,13 @@ DO NOTHING
|
||||||
INSERT INTO customers
|
INSERT INTO customers
|
||||||
(name, email)
|
(name, email)
|
||||||
VALUES ('Microsoft', 'hotline@microsoft.com')
|
VALUES ('Microsoft', 'hotline@microsoft.com')
|
||||||
ON CONFLICT (name, TRIM(email))
|
ON CONFLICT ((foo + ?), name, (TRIM(email)))
|
||||||
DO NOTHING
|
DO NOTHING
|
||||||
"]
|
" 1]
|
||||||
(format {:insert-into :customers
|
(format {:insert-into :customers
|
||||||
:columns [:name :email]
|
:columns [:name :email]
|
||||||
:values [[[:inline "Microsoft"], [:inline "hotline@microsoft.com"]]]
|
:values [[[:inline "Microsoft"], [:inline "hotline@microsoft.com"]]]
|
||||||
:on-conflict [:name [:trim :email]]
|
:on-conflict [[:+ :foo 1] :name [:trim :email]]
|
||||||
:do-nothing true}
|
:do-nothing true}
|
||||||
{:pretty true})))
|
{:pretty true})))
|
||||||
(is (= ["
|
(is (= ["
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue