Dmitry Tkach <dmitry(at)openratings(dot)com> writes:
> As for 'what SQL code', you can set debug_print_query=true in
> postgresql.conf - this will make it print all the sql queries you
> execute to the log file...
In recent releases (7.3 for sure, not sure about older ones) there
is also a log_min_error_statement setting that can be tweaked to log
only queries generating errors.
regards, tom lane