diff --git a/CHANGELOG.md b/CHANGELOG.md index 33fb135..e30d18a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,12 +2,14 @@ * 2.4.next in progress * Fix [#486](https://github.com/seancorfield/honeysql/issues/486) by supporting ANSI-style `INTERVAL` syntax. + * Fix [#485](https://github.com/seancorfield/honeysql/issues/485) by adding `:with-ordinality` "operator". * Fix [#484](https://github.com/seancorfield/honeysql/issues/484) by adding `TABLE` to `TRUNCATE`. * Fix [#483](https://github.com/seancorfield/honeysql/issues/483) by adding a function-like `:join` syntax to produce nested `JOIN` expressions. * 2.4.1011 -- 2023-03-23 * Address [#481](https://github.com/seancorfield/honeysql/issues/481) by adding more examples around `:do-update-set`. * Address [#480](https://github.com/seancorfield/honeysql/issues/480) by clarifying the general relationship between clauses and helpers. * Address [#448](https://github.com/seancorfield/honeysql/issues/448) by adding a new section with hints and tips for database-specific syntax and solutions. + * Update `tools.build`; split alias `:test`/`:runner` for friendlier jack-in UX while developing. * 2.4.1006 -- 2023-03-17 * Fix [#478](https://github.com/seancorfield/honeysql/issues/478) by handling `:do-update-set` correctly in the `upsert` helper and by handling parameters correctly in the `:do-update-set` formatter. diff --git a/doc/operator-reference.md b/doc/operator-reference.md index dcbc8a6..b7aef9b 100644 --- a/doc/operator-reference.md +++ b/doc/operator-reference.md @@ -120,6 +120,17 @@ as an alias for `regexp`. `similar-to` and `not-similar-to` are also supported. +## with ordinality + +The ANSI SQL `WITH ORDINALITY` expression is supported as an infix operator: + +```clojure +{... + [:with-ordinality [:jsonb_array_elements :j] [:arr :item :index]] + ...} +;;=> ["...JSONB_ARRAY_ELEMENTS(j) WITH ORDINALITY ARR(item, index)..."] +``` + ## || String concatenation operator. diff --git a/src/honey/sql.cljc b/src/honey/sql.cljc index 5b564a1..f981aeb 100644 --- a/src/honey/sql.cljc +++ b/src/honey/sql.cljc @@ -1323,7 +1323,8 @@ (-> #{"mod" "and" "or" "xor" "<>" "<=" ">=" "||" "<->" "like" "not-like" "regexp" "~" "&&" "ilike" "not-ilike" "similar-to" "not-similar-to" - "is" "is-not" "not=" "!=" "regex"} + "is" "is-not" "not=" "!=" "regex" + "with-ordinality"} (into (map str "+-*%|&^=<>")) (into (keys infix-aliases)) (into (vals infix-aliases))