From 16a9708790bf9d9e1d03e9d5875ffe22b55ab6a2 Mon Sep 17 00:00:00 2001 From: Sean Corfield Date: Sat, 26 Aug 2023 16:48:59 -0700 Subject: [PATCH] tests for #496 --- test/honey/sql_test.cljc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/honey/sql_test.cljc b/test/honey/sql_test.cljc index 3230a3d..5898828 100644 --- a/test/honey/sql_test.cljc +++ b/test/honey/sql_test.cljc @@ -1203,6 +1203,18 @@ ORDER BY id = ? DESC (is (= ["INNER JOIN (tbl1 LEFT JOIN tbl2 USING (id))"] (sut/format {:join [[[:join :tbl1 {:left-join [:tbl2 [:using :id]]}]]]}))))) +(deftest issue-496-overriding + (is (= ["INSERT INTO table (a, b) OVERRIDING SYSTEM VALUE VALUES (?, ?)" 1 2] + (sut/format {:insert-into [{:overriding-value :system} :table] + :columns [:a :b] + :values [[1 2]]}))) + (is (= ["INSERT INTO table (a, b) OVERRIDING USER VALUE VALUES (?, ?)" 1 2] + (sut/format {:insert-into [{:overriding-value :user} :table [:a :b]] + :values [[1 2]]}))) + (is (= ["INSERT INTO table (a, b) OVERRIDING SYSTEM VALUE VALUES (?, ?)" 1 2] + (sut/format {:insert-into [{:overriding-value :system} :table] + :values [{:a 1 :b 2}]})))) + (deftest issue-497-alias (is (= ["SELECT column_name AS \"some-alias\" FROM b ORDER BY \"some-alias\" ASC"]