in reply to DBI - check erroneous statement?
It can be easier to tail the DB's logfile (it's a good idea to keep an eye on it anyway).
For PostgreSQL see the chapter on Server configuration, which includes logging.