Test program (C++0x) attached. Run it with a connection info string as argv[1]. It should print a dot once per second while the DB connection is OK, but will print the PQerrorMessage text when the connection fails, and then will PQreset the connection. Each time it prints the error you can see all the previous error content and the error buffer just keeps growing and growing rather than resetting when PQreset is called.
If instead of calling "PQreset", one calls "PQfinish" and "PQconnectdb" (e.g. change the call from "reset" to "reconnect" on line 39), you'll (naturally) see just the most recent error.