From 19e73a3ebdba8b5637f60d88c615541a46b89a0f Mon Sep 17 00:00:00 2001 From: Sean Corfield Date: Sat, 10 Jun 2023 19:18:36 -0700 Subject: [PATCH] fix #493 by clarifying with values --- CHANGELOG.md | 1 + doc/clause-reference.md | 2 ++ 2 files changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d38281d..8755ab7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Changes * 2.4.next in progress + * Address [#493](https://github.com/seancorfield/honeysql/issues/493) by clarifying use of `:values` in CTEs (using `:with`). * Address [#489](https://github.com/seancorfield/honeysql/issues/489) by adding more examples around `:update`. * 2.4.1033 -- 2023-05-22 diff --git a/doc/clause-reference.md b/doc/clause-reference.md index 67ce8dd..38ed555 100644 --- a/doc/clause-reference.md +++ b/doc/clause-reference.md @@ -431,6 +431,8 @@ user=> (sql/format {:with [[[:stuff {:columns [:id :name]}] ["WITH stuff (id, name) AS (VALUES (?, ?), (?, ?)) SELECT id, name FROM stuff" 1 "Sean" 2 "Jay"] ``` +> Note: you must use the vector-of-vectors format for `:values` here -- if you try to use the vector-of-maps format, `VALUES` will be preceded by the column names (keys from the maps) and the resultant SQL will be invalid. + `:with-recursive` follows the same rules as `:with` and produces `WITH RECURSIVE` instead of just `WITH`. ## intersect, union, union-all, except, except-all