You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: test/honeysql_postgres/postgres_test.cljc
+37
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,8 @@
8
8
:refer
9
9
[add-column
10
10
alter-table
11
+
case-when
12
+
case-when-else
11
13
create-extension
12
14
create-table
13
15
create-view
@@ -19,6 +21,8 @@
19
21
drop-table
20
22
filter
21
23
insert-into-as
24
+
join-lateral
25
+
left-join-lateral
22
26
on-conflict
23
27
on-conflict-constraint
24
28
over
@@ -334,3 +338,36 @@
334
338
(-> (drop-extension:uuid-ossp)
335
339
(sql/format:allow-dashed-names?true
336
340
:quoting:ansi))))))
341
+
342
+
(deftestcase-when-test
343
+
(is (= ["CASE WHEN x = 1 THEN x WHEN x > 1 THEN y END"]
344
+
(-> (case-when [:=:x (sql/inline1)] :x
345
+
[:>:x (sql/inline1)] :y)
346
+
sql/format))))
347
+
348
+
(deftestcase-when-else-test
349
+
(is (= ["CASE WHEN x = 1 THEN x WHEN x > 1 THEN y ELSE z END"]
350
+
(-> (case-when-else [:=:x (sql/inline1)] :x
351
+
[:>:x (sql/inline1)] :y
352
+
:z)
353
+
sql/format))))
354
+
355
+
(deftestjoin-lateral-test
356
+
(is (= ["SELECT count(x3), count(x0) FROM x_values INNER JOIN LATERAL (SELECT (CASE WHEN x > 3 THEN x END) AS x3, (CASE WHEN x > 0 THEN x END) AS x0) z ON true"]
(is (= ["SELECT count(x3), count(x0) FROM x_values LEFT JOIN LATERAL (SELECT (CASE WHEN x > 3 THEN x END) AS x3, (CASE WHEN x > 0 THEN x END) AS x0) z ON true"]
0 commit comments