Running Postgresql in a better ask for forgiveness than permission mode during the inserts.
Works great, only problem: The logs are flooded with the following message
duplicate key value violates unique constraint
Is there a possibility to explictly disable this log?
-
There is a hook, emit_log_hook, that should allow an extension to do what you want. But I don't see any existing extensions which do it. github.com/harukat/pg_truncate_log_message does something a bit different, but perhaps could serve as a good starting point if you are interested.jjanes– jjanes2019年08月27日 15:55:11 +00:00Commented Aug 27, 2019 at 15:55
1 Answer 1
You could use
INSERT ... ON CONFLICT DO NOTHING
and check if a row was inserted or not.
answered Aug 27, 2019 at 5:58
lang-sql