PostgreSQL – Disable Log Error for Duplicate Key Value Violation

loggingpostgresql

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?

Best Answer

You could use

INSERT ... ON CONFLICT DO NOTHING

and check if a row was inserted or not.

Related Question