diff --git a/lib/modules/Sql.pmod/pgsql.pike b/lib/modules/Sql.pmod/pgsql.pike
index c190f72a200cae3c39e7c7094f7bcd95f686a72d..02ebc3cc3ee64d671f933846e29b4861dd8a3fb7 100644
--- a/lib/modules/Sql.pmod/pgsql.pike
+++ b/lib/modules/Sql.pmod/pgsql.pike
@@ -1270,11 +1270,13 @@ protected void destroy() {
   /*
    * Flush out any asynchronously reported errors to stderr; because we are
    * inside a destructor, throwing an error will not work anymore.
+   * Warnings will be silently discarded at this point.
    */
+  lastmessage = filter(lastmessage, has_prefix, "ERROR ");
   if (err || (err = catch(errstring = error(1))))
     werror(describe_backtrace(err));
   else if (errstring && sizeof(errstring))
-    werror(errstring);
+    werror("%s\n", errstring);		// Add missing terminating newline
 }
 
 final void _connectfail(void|mixed err) {