Have you thought about `COPY TO` (a.k.a. "copy out")?  As-is this seems to foreclose doing something about that.  Is it credible to use the protocol state returned from the server to determine what direction the COPY is in?  If that is done, could statement-sniffing be avoided altogether?