jOOQ 3.7+ supports PostgreSQL 9.5’s ON CONFLICT clause:
- https://github.com/jOOQ/jOOQ/issues/4299
- http://www.postgresql.org/docs/9.5/static/sql-insert.html
The full PostgreSQL vendor-specific syntax is not yet supported, but you can use the MySQL or H2 syntax, which can both be emulated using PostgreSQL’s ON CONFLICT:
MySQL INSERT .. ON DUPLICATE KEY UPDATE:
DSL.using(configuration)
.insertInto(TABLE)
.columns(ID, A, B)
.values(1, "a", "b")
.onDuplicateKeyUpdate()
.set(A, "a")
.set(B, "b")
.execute();
H2 MERGE INTO ..
DSL.using(configuration)
.mergeInto(TABLE, A, B, C)
.values(1, "a", "b")
.execute();