SELECT id
FROM (
INSERT INTO foo(natural_key)
VALUES ('aKey')
ON CONFLICT DO NOTHING
RETURNING id
) ins
WHERE id IS NOT NULL
UNION DISTINCT
SELECT id
FROM foo
WHERE natural_key = 'aKey';WITH ins AS (
INSERT INTO foo(natural_key)VALUES ('aKey')ON CONFLICT DO NOTHINGRETURNING id)
SELECT idFROM ins
WHERE id IS NOT NULLUNION DISTINCTSELECT idFROM fooWHERE natural_key = 'aKey';
--
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 jooq-user+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to jooq-user+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "jOOQ User Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jooq-user/QsjcRa8NnnY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jooq-user+...@googlegroups.com.