I want to emulate the following insert statement (listed here
<https://stackoverflow.com/a/46728249/1141285>) in jOOQ :
INSERT INTO key_value_pair (key, value, is_active) VALUES ('temperature','20',
false) ON CONFLICT (key) WHERE is_active
DO UPDATESET value = '33', is_active = true;
To do this, I am writing the following code :
dslContext.insertInto(KEY_VALUE_PAIR).columns(KEY_VALUE_PAIR.KEY,
KEY_VALUE_PAIR.VALUE, KEY_VALUE_PAIR.IS_ACTIVE)
.values("temperature", "20", false)
.onConflict(KEY_VALUE_PAIR.KEY, KEY_VALUE_PAIR.VALUE,
KEY_VALUE_PAIR.IS_ACTIVE).doNothing().execute();
but, it fails with the following error :
*nested exception is org.postgresql.util.PSQLException: ERROR: there is no
unique or exclusion constraint matching the ON CONFLICT specification*
The partial index that I am using is :
CREATE INDEX key_and_value_if_is_active_true_unique ON key_value_pair (key,
value) WHERE is_active = true;
The question is : I think jOOQ does not support the WHERE index predicate
in the onConflict clause. Is there a workaround for this?
--
You received this message because you are subscribed to the Google Groups "jOOQ
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.