From b0af4539941c0bb3022bc1b3ebc3858f47b92940 Mon Sep 17 00:00:00 2001 From: Sean Corfield Date: Fri, 25 Mar 2022 20:53:56 -0700 Subject: [PATCH] fix #203 by adding tip about doubling up ? --- CHANGELOG.md | 1 + doc/tips-and-tricks.md | 2 ++ 2 files changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ee9c18..fc7b1eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ Only accretive/fixative changes will be made from now on. * 1.2.next in progress + * Address [#203](https://github.com/seancorfield/next-jdbc/issues/203) by adding a note to the **PostgreSQL Tips & Tricks** section. * Update `build-clj` to v0.8.0. * 1.2.772 -- 2022-02-09 diff --git a/doc/tips-and-tricks.md b/doc/tips-and-tricks.md index bdaaf15..0c25344 100644 --- a/doc/tips-and-tricks.md +++ b/doc/tips-and-tricks.md @@ -281,6 +281,8 @@ That call produces a vector `["fr"]` with metadata that implements `set-paramete PostgreSQL has good support for [storing, querying and manipulating JSON data](https://www.postgresql.org/docs/current/datatype-json.html). Basic Clojure data structures (lists, vectors, and maps) transform pretty well to JSON data. With a little help `next.jdbc` can automatically convert Clojure data to JSON and back for us. +> Note: some PostgreSQL JSONB operators have a `?` in them which conflicts with the standard parameter placeholder in SQL. You can write the JSONB operators by doubling up the `?`, e.g., `??|` instead of just `?|`. See [PostgreSQL JSONB operators](https://www.postgresql.org/docs/current/functions-json.html#FUNCTIONS-JSONB-OP-TABLE) for more detail. + First we define functions for JSON encoding and decoding. We're using [metosin/jsonista](https://github.com/metosin/jsonista) in these examples but you could use any JSON library, such as [Cheshire](https://github.com/dakrone/cheshire) or [clojure.data.json](https://github.com/clojure/data.json). ```clojure