Hi Lukas,

I have never used this functionality. I'm affraid there is no way to
do this without transactions.

It's probably a bit tricky to let jOOQ wrap this in a transaction, as
it's possible that a transaction was already started by the user. If
you want to do this, you'll have to make sure that you only start (and
commit) a transaction when you're not already in one.

In PostgreSQL, when you're not using explicit transactions, every user
executed statement runs in its own transaction. So you could make a
function that executes the select followed by insert or update. But
this means you'll have to store that function in the database schema.

In PostgreSQL 9 the 'DO' statement was added, which allows executing
code without storing it in a function first, see
http://www.postgresql.org/docs/9.0/static/sql-do.html . This probably
allows you to implement this kind of logic in jOOQ, without having to
add stored functions in PostgreSQL. But it won't work in older
versions of PostgreSQL.

- Sander

Reply via email to