From a3ef21548520636168a970d780ff46a4be4fa002 Mon Sep 17 00:00:00 2001 From: Sean Corfield Date: Mon, 24 Jun 2024 20:23:59 -0700 Subject: [PATCH] fixes #526 by using format-var in ddl destructuring instead of format-entity Signed-off-by: Sean Corfield --- CHANGELOG.md | 3 ++- src/honey/sql.cljc | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 548e398..70da4d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,8 @@ # Changes * 2.6.next in progress - * Address [#533](https://github.com/seancorfield/honeysql/issues/533) by adding `honey.sql/*escape-?*` which can be bound to `false` to prevent `?` being escaped to `??` when used as an operator, function, or + * Address [#533](https://github.com/seancorfield/honeysql/issues/533) by adding `honey.sql/*escape-?*` which can be bound to `false` to prevent `?` being escaped to `??` when used as an operator or function. + * Address [#526](https://github.com/seancorfield/honeysql/issues/526) by using `format-var` in DDL, instead of `format-entity`. * Update JDK test matrix (adopt -> temurin, 19 -> 21). * 2.6.1147 -- 2024-06-12 diff --git a/src/honey/sql.cljc b/src/honey/sql.cljc index 60a05f2..4069e83 100644 --- a/src/honey/sql.cljc +++ b/src/honey/sql.cljc @@ -1233,7 +1233,14 @@ :else [(butlast coll) (last coll) nil]))] (into [(str/join " " (map sql-kw prequel)) - (when table (format-entity table)) + (when table + (let [[v & more] (format-var table)] + (when (seq more) + (throw (ex-info (str "DDL syntax error at: " + (pr-str table) + " - expected table name") + {:unexpected more}))) + v)) (when ine (sql-kw ine))] (when opts (format-ddl-options opts context)))))