From 80836898217426f76e8356fb00172a5174ce11e3 Mon Sep 17 00:00:00 2001 From: Sean Corfield Date: Thu, 20 Feb 2020 07:21:17 -0800 Subject: [PATCH] Note PG returns entire row --- doc/friendly-sql-functions.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/friendly-sql-functions.md b/doc/friendly-sql-functions.md index 25ce990..f6bfb64 100644 --- a/doc/friendly-sql-functions.md +++ b/doc/friendly-sql-functions.md @@ -285,6 +285,8 @@ Ah, dear old Oracle! Over the years of maintaining `clojure.java.jdbc` and now ` ### PostgreSQL +When you use `:return-keys true` with `execute!` or `execute-one!` (or you use `insert!`), PostgreSQL returns the entire inserted row (unlike nearly every other database that just returns any generated keys!). + If you have a query where you want to select where a column is `IN` a sequence of values, you can use `col = ANY(?)` with a native array of the values instead of `IN (?,?,?,,,?)` and a sequence of values. What does this mean for your use of `next.jdbc`? In `plan`, `execute!`, and `execute-one!`, you can use `col = ANY(?)` in the SQL string and a single primitive array parameter, such as `(int-array [1 2 3 4])`. That means that in `next.jdbc.sql`'s functions that take a where clause (`find-by-keys`, `update!`, and `delete!`) you can specify `["col = ANY(?)" (int-array data)]` for what would be a `col IN (?,?,?,,,?)` where clause for other databases and require multiple values.