Postgres: use prepared INSERT on remote server instead of COPY only.

On remote PG server, it is not possible to use COPY queries as files must be present on the server.

Instead, use prepared statement, which is slower but allow remote queries.

(See issue #777)