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: "Etsuro Fujita" <fujita.etsuro@lab.ntt.co.jp>
Cc: pgsql-hackers@postgresql.org
Date: 2012-09-13T14:25:21Z
Lists: pgsql-hackers
"Etsuro Fujita" <fujita.etsuro@lab.ntt.co.jp> writes:
> I'd like to add the following options to the SQL COPY command and the psql \copy
> instruction:

>     * PREPROCESSOR: Specifies the user-supplied program for COPY IN.  The data
> from an input file is preprocessed by the program before the data is loaded into
> a postgres table.
>     * POSTPROCESSOR: Specifies the user-supplied program for COPY OUT.  The data
> from a postgres table is postprocessed by the program before the data is stored
> in an output file.

The proposed patch causes the external processor programs to execute
with the privileges of the database server, which seems like a pretty
horrid idea.  At the very least this would imply limiting use of the
feature to superusers, which greatly restricts its use-case.

I think it would be a lot better if this were designed so that the
processor programs executed on client side.  Which would probably make
it not a COPY patch at all, but something in psql.

			regards, tom lane