Postgresql – How to configure PostgreSQL 8.3 to log bind parameters

logspostgresql

I'm running into some unique constraint problems with my database. I can't reproduce them, but see error messages from our production system:

exception 'UniqueViolation' with message 
    'SQLSTATE[23505]: Unique violation: 7 ERROR:  
    duplicate key value violates unique constraint...'

When I check the log files, I see the statement causing the exception.

Unfortunately, I don't see what the bind parameters for the SQL statement are.

The documentation for 8.3 seems to indicate that I could log the bind parameters, but I cannot determine how to turn on logging.

Can anybody help me figure out what to change in postgresql.conf?

Best Answer

I'm not sure how to make those visible in 8.3 except with this:

log_statement = all

That's going to put a lot of data in to your logs though, so you may not want to keep it turned on for long. Also make sure you have the process ID included in your log_line_prefix if you want to match everything up easily.