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

Поиск
Список
Период
Сортировка
От Etsuro Fujita
Тема Re: WIP patch: add (PRE|POST)PROCESSOR options to COPY
Дата
Msg-id 009101cd957a$e37189b0$aa549d10$@lab.ntt.co.jp
обсуждение исходный текст
Ответ на Re: WIP patch: add (PRE|POST)PROCESSOR options to COPY  (Craig Ringer <ringerc@ringerc.id.au>)
Ответы Re: WIP patch: add (PRE|POST)PROCESSOR options to COPY  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
> From: Craig Ringer [mailto:ringerc@ringerc.id.au]

> On 09/13/2012 10:25 PM, Tom Lane wrote:
> > 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.

Maybe my explanation was insufficient.  Let me add one thing to my earlier
explanation.  The submitted patch allows the psql \copy instruction to be
executed like:

$ echo '/bin/gunzip -c $1' > decompress.sh
$ chmod +x decompress.sh

postgres=# \copy foo FROM '/home/pgsql/foo.csv.gz' WITH (format 'csv',
preprocessor '/home/pgsql/decompress.sh')

In this example, command "/home/pgsql/decompress.sh /home/pgsql/foo.csv.gz" is
executed on client side, by using popen(), and command "COPY foo FROM STDIN WITH
(format 'csv')" is sent to backend.  I apologize for not providing you with
enough explanation.

> Either that, or allow the pre- and post- processors to be programs
> written in a (possibly trusted) PL.

I would like to add the hooks not only for the psql \copy instrucntion, but also
for the SQL COPY command, because I think the hooks for the SQL COPY command
would allow to realize variants of contrib/file_fdw such as compressed file FDW
and Hadoop HDFS FDW, etc., which I think would be useful especially for DWH
environments.

Thanks,

Best regards,
Etsuro Fujita




В списке pgsql-hackers по дате отправления:

Предыдущее
От: Florian.Schoppmann@emc.com (Florian Schoppmann)
Дата:
Сообщение: Invalid optimization of VOLATILE function in WHERE clause?
Следующее
От: Hitoshi Harada
Дата:
Сообщение: Re: [PATCH]Tablesample Submission