Skip to content

Commit

Permalink
fix #399 by correcting docs and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
seancorfield committed Mar 26, 2022
1 parent c4efcc0 commit ab7c235
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Changes

* 2.2.next in progress
* Address [#399](https://github.com/seancorfield/honeysql/issues/399) by correcting multi-column `RETURNING` clauses in docs and tests.
* Address [#398](https://github.com/seancorfield/honeysql/issues/398) by adding `honey.sql.pg-json` namespace that registers PostgreSQL JSON operators and provides symbolic names for "unwritable" operators (that contain `@`).
* Fix [#387](https://github.com/seancorfield/honeysql/issues/387) again.
* Update CI to reflect Clojure 1.11 release (master -> 1.11; new master is 1.12).
Expand Down
4 changes: 2 additions & 2 deletions doc/postgresql.md
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,9 @@ user=> (sql/format {:delete-from :distributors
user=> (-> (update :distributors)
(set {:dname "Foo Bar Designs"})
(where [:= :did 2])
(returning [:did :dname])
(returning :did :dname)
sql/format)
["UPDATE distributors SET dname = ? WHERE did = ? RETURNING did dname"
["UPDATE distributors SET dname = ? WHERE did = ? RETURNING did, dname"
"Foo Bar Designs" 2]
```

Expand Down
6 changes: 3 additions & 3 deletions src/honey/sql/helpers.cljc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;; copyright (c) 2020-2021 sean corfield, all rights reserved
;; copyright (c) 2020-2022 sean corfield, all rights reserved

(ns honey.sql.helpers
"Helper functions for the built-in clauses in honey.sql.
Expand Down Expand Up @@ -870,9 +870,9 @@
"Accepts any number of column names to return from an
insert operation:
(returning :*)
(returning :*) and (returning :a :b)
Produces: RETURNING *"
Produce: RETURNING * and RETURNING a, b respectively."
[& cols]
(generic :returning cols))

Expand Down
4 changes: 2 additions & 2 deletions test/honey/sql/postgres_test.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,11 @@
(sql/format {:delete-from :distributors
:where [:> :did :10]
:returning [:*]})))
(is (= ["UPDATE distributors SET dname = ? WHERE did = 2 RETURNING did dname" "Foo Bar Designs"]
(is (= ["UPDATE distributors SET dname = ? WHERE did = 2 RETURNING did, dname" "Foo Bar Designs"]
(-> (update :distributors)
(set {:dname "Foo Bar Designs"})
(where [:= :did :2])
(returning [:did :dname])
(returning :did :dname)
sql/format)))))

(deftest create-view-test
Expand Down

0 comments on commit ab7c235

Please sign in to comment.