fix #462 by adding precedence caveat to docs

This commit is contained in:
Sean Corfield 2023-03-03 15:52:52 -08:00
parent 1d7237884d
commit 7e35cb31bf
3 changed files with 6 additions and 1 deletions

View file

@ -9,6 +9,7 @@
* Fix [#465](https://github.com/seancorfield/honeysql/issues/465) to allow multiple columns in `:order-by` special syntax via PR [#468](https://github.com/seancorfield/honeysql/pull/468) [@p-himik](https://github.com/p-himik).
* Fix [#464](https://github.com/seancorfield/honeysql/issues/464) by adding an optional type argument to `:array` via PR [#469](https://github.com/seancorfield/honeysql/pull/469) [@p-himik](https://github.com/p-himik).
* Address [#463](https://github.com/seancorfield/honeysql/issues/463) by explaining `:quoted nil` via PR [#475](https://github.com/seancorfield/honeysql/pull/475) [@nharsch](https://github.com/nharsch).
* Address [#462](https://github.com/seancorfield/honeysql/issues/462) by adding a note in the documentation for set operations, clarifying precedence issues.
* 2.4.980 -- 2023-02-15
* Fix [#461](https://github.com/seancorfield/honeysql/issues/461) -- a regression introduced in 2.4.979 -- by restricting unary operators to just `+`, `-`, and `~` (bitwise negation).

View file

@ -538,6 +538,8 @@ There are also helpers for each of those:
=> ["SELECT * FROM foo UNION SELECT * FROM bar"]
```
> Note: different databases have different precedence rules for these set operations when used in combination -- you may need to use `:nest` to add `(` .. `)` in order to combine these operations in a single SQL statement, if the natural order produced by HoneySQL does not work "as expected" for your database.
### Functions
Function calls (and expressions with operators) can be specified as

View file

@ -439,6 +439,8 @@ user=> (sql/format '{union [{select (id,status) from (table-a)}
["SELECT id, status FROM table_a UNION SELECT id, event AS status, from, table_b"]
```
> Note: different databases have different precedence rules for these set operations when used in combination -- you may need to use `:nest` to add `(` .. `)` in order to combine these operations in a single SQL statement, if the natural order produced by HoneySQL does not work "as expected" for your database.
## select, select-distinct, table
`:select` and `:select-distinct` expect a sequence of SQL entities (column names
@ -482,7 +484,7 @@ user=> (sql/format {:select [[:* :except [:a :b] :replace [[[:inline 2] :c]]]] :
```
The `:table` clause is equivalent to `:select :* :from` and accepts just
a simple table name -- `:create-table-as` above for an example.
a simple table name -- see `:create-table-as` above for an example.
## select-distinct-on