Re: WIP patch: add (PRE|POST)PROCESSOR options to COPY

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Simon Riggs <simon@2ndQuadrant.com>
Cc: 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:46:55Z
Lists: pgsql-hackers
Simon Riggs <simon@2ndQuadrant.com> writes:
> On 14 November 2012 15:09, Fujii Masao <masao.fujii@gmail.com> wrote:
>> I'd just like to execute
>> COPY vmstat_table FROM 'vmstat' WITH ...

> If we go ahead with this, I think it needs additional keyword to
> indicate that we will execute the file rather than read from it. I
> don't think we should rely on whether the file is executable or not to
> determine how we should treat it.

Agreed, and there's also the question of passing switches etc to the
program, so the string can't be a bare file name anyway.  I proposed
pipe symbols (|) in the string previously, but if you find that too
Unix-centric I suppose we could do

	COPY TABLE FROM PROGRAM 'command line';
	COPY TABLE TO PROGRAM 'command line';

			regards, tom lane