Stephen Frost <sfr...@snowman.net> writes: > * Magnus Hagander (mag...@hagander.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