From 4f5b0ed256caa026a39ff06f4d694d798f520d1f Mon Sep 17 00:00:00 2001 From: Sean Corfield Date: Thu, 16 Jan 2025 15:57:54 -0800 Subject: [PATCH] fix default values clause bug Signed-off-by: Sean Corfield --- CHANGELOG.md | 1 + doc/clause-reference.md | 2 +- src/honey/sql.cljc | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 33fe9b1..3423326 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ * More performance optimizations via PR [#560](https://github.com/seancorfield/honeysql/pull/560) [@alexander-yakushev](https://github.com/alexander-yakushev). * Fix two broken links to the [HoneySQL web app](https://john.shaffe.rs/honeysql/) via PR [#559](https://github.com/seancorfield/honeysql/pull/559) [@whatacold](https://github.com/whatacold). * Make SQL Server dialect auto-lift Boolean values to parameters since SQL Server has no `TRUE` / `FALSE` literals. + * Fix bug in `DEFAULT` values clause (that omitted some values). * 2.6.1243 -- 2024-12-13 * Address [#558](https://github.com/seancorfield/honeysql/issues/558) by adding `:patch-into` (and `patch-into` helper) for XTDB (but in core). diff --git a/doc/clause-reference.md b/doc/clause-reference.md index 7422f80..a7fb025 100644 --- a/doc/clause-reference.md +++ b/doc/clause-reference.md @@ -1421,7 +1421,7 @@ user=> (sql/format {:insert-into :table :values [{:a 1 :b 2 :c 3} :default {:a 4 :b 5 :c 6}]}) -["INSERT INTO table (a, b, c) VALUES (?, ?, ?), DEFAULT, (?, ?, ?)" 6 5 4] +["INSERT INTO table (a, b, c) VALUES (?, ?, ?), DEFAULT, (?, ?, ?)" 1 2 3 4 5 6] user=> (sql/format {:insert-into :table :values [[1 2 3] :default [4 5 6]]}) ["INSERT INTO table VALUES (?, ?, ?), DEFAULT, (?, ?, ?)" 1 2 3 4 5 6] diff --git a/src/honey/sql.cljc b/src/honey/sql.cljc index d7e5621..a5d79b4 100644 --- a/src/honey/sql.cljc +++ b/src/honey/sql.cljc @@ -1203,7 +1203,7 @@ (if (sequential? sqls') (str "(" (join ", " sqls') ")") sqls')) - (if params' (into params params') params')]) + (if params' (into params params') params)]) [[] []] (map (fn [m] (if (map? m)