Re: [PATCH 4/4] Add tests to dblink covering use of COPY TO FUNCTION
Daniel Farina <dfarina@truviso.com>
From: Daniel Farina <dfarina@truviso.com>
To: Andrew Dunstan <andrew@dunslane.net>
Cc: Greg Smith <greg@2ndquadrant.com>, Robert Haas <robertmhaas@gmail.com>, pgsql-hackers@postgresql.org
Date: 2009-11-24T00:06:34Z
Lists: pgsql-hackers
On Mon, Nov 23, 2009 at 4:03 PM, Daniel Farina <dfarina@truviso.com> wrote: > Yes. Take a look at the tests introduced to core PostgeSQL (see patch > 2), where instead of returning a text[] I return just a single text of > the verbatim output of the copy. You could imagine making that an SRF > instead. It would have to understand COPY row delimiters in whatever > mode you were operating in, though. Actually, sorry, I lie, but not in a bad way.... Since COPY operates row at a time (rather than a stream of bytes with arbitrary boundaries) you could rely on being passed each record one-at-a-time. You don't have to understand the delimiter. So you could even make a bytea[][] that even contains the binary output, the first dimension being row number, the second being the bytes themselves. The header would pose an interesting problem, though. fdr