Re: WIP patch: add (PRE|POST)PROCESSOR options to COPY
Andrew Dunstan <andrew@dunslane.net>
From: Andrew Dunstan <andrew@dunslane.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>, Simon Riggs <simon@2ndquadrant.com>, Fujii Masao <masao.fujii@gmail.com>, Etsuro Fujita <fujita.etsuro@lab.ntt.co.jp>, Craig Ringer <ringerc@ringerc.id.au>, pgsql-hackers@postgresql.org
Date: 2012-11-14T16:32:58Z
Lists: pgsql-hackers
On 11/14/2012 11:20 AM, Tom Lane wrote:
> I disagree with Simon's objection also, because neither reading from
> nor writing to an external program is likely to fit the model of
> reading/updating a table very well. For instance, there's no good
> reason to suppose that reading twice will give the same results. So
> force-fitting this usage into the FDW model is not going to work well.
>
> Nor do I really see the argument why a "pipe_fdw" module is cleaner
> than a "COPY TO/FROM pipe" feature.
>
>
Yeah, I agree, although the syntax looks a bit unclean.
Maybe something like
COPY foo FROM wherever WITH (FILTER '/path/to/program')
might work better. You'd hook up the source to the filter as its stdin
and read its stdout. Not sure what we'd do for \copy though.
cheers
andrew