Is it possible to have the database name, datetime, and maybe even the query itself show up in pgsql's error log?
Plenty of options to log all sorts of info. See the manuals chapter "16.4.6. Error Reporting and Logging" for details.
You can even increase detail settings in one particular connection using SET ...
-- Richard Huxton Archonet Ltd
---------------------------(end of broadcast)--------------------------- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to majordomo@xxxxxxxxxxxxxx)