Stop PostgreSQL from logging statements on error
The amount of details logged is controlled by log_error_verbosity. Setting it to TERSE will exclude DETAIL, HINT, QUERY, and CONTEXT error information:

ALTER DATABASE db_name SET log_error_verbosity to 'TERSE';