Re: Function to execute a program

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Stephen Frost <sfrost(at)snowman(dot)net>
Cc: Magnus Hagander <magnus(at)hagander(dot)net>, PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Function to execute a program
Date: 2020-09-14 14:45:31
Message-ID: 1027425.1600094731@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Stephen Frost <sfrost(at)snowman(dot)net> writes:
> * Magnus Hagander (magnus(at)hagander(dot)net) wrote:
>> Would it make sense to have a pg_execute_program() that corresponds to COPY
>> FROM PROGRAM? This would obviously have the same permissions restrictions
>> as COPY FROM PROGRAM.

> I'd rather come up with a way to import this kind of object into PG by
> using COPY rather than adding a different way to pull them in.

I'm not for overloading COPY to try to make it handle every data import
use-case. The issue here AIUI is that Magnus wants the program output
to be read as an uninterpreted blob (which he'll then try to convert to
jsonb or whatever, but that's not the concern of the import code). This
is exactly antithetical to COPY's mission of reading some rows that are
made up of some columns and putting the result into a table.

Yeah, we could no doubt add some functionality to disable all the
row-splitting and column-splitting and associated escaping logic,
but that's going to make COPY slower and more complicated. And it
still doesn't address wanting to use the result directly in a query
instead of sticking it into a table.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Domagoj Smoljanovic 2020-09-14 14:49:45 RE: pg_restore causing deadlocks on partitioned tables
Previous Message Alvaro Herrera 2020-09-14 14:40:04 Re: pg_restore causing deadlocks on partitioned tables