Buffer writes to the PostgreSQL socket

Avoid sending a packet for each write