1

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?

1
  • 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. Commented Aug 27, 2019 at 15:55

1 Answer 1

1

You could use

INSERT ... ON CONFLICT DO NOTHING

and check if a row was inserted or not.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.