Fork me on GitHub

Hi! I was wondering: say you want to make a single update! call, that can update more than one row (where clause matching many), how can I get back the rows that were updated? (db is postgresql)


as I understand it, (update! db-spec :items {:checked true} ["color like '%black%'"]) => [17]


adding {:return-keys true}, returns one row only


@leontalbot figure out how to do it in SQL first. There's no magic in Java.jdbc -- it's just calling the Postgresql driver to do whatever you tell it.

👍 5

That said, as noted before, I would not expect :return-keys to do anything sensible on an update (but under the hood all that does is ask the Postgresql driver to return any generated keys on the preparated statement).