Re: [PATCH 4/4] Add tests to dblink covering use of COPY TO FUNCTION - Mailing list pgsql-hackers

From Pavel Stehule
Subject Re: [PATCH 4/4] Add tests to dblink covering use of COPY TO FUNCTION
Date
Msg-id 162867790911242303p30cef474jf726b990f4d9a2e7@mail.gmail.com
Whole thread Raw
In response to Re: [PATCH 4/4] Add tests to dblink covering use of COPY TO FUNCTION  (Pavel Stehule <pavel.stehule@gmail.com>)
List pgsql-hackers
2009/11/25 Pavel Stehule <pavel.stehule@gmail.com>:
> 2009/11/25 Daniel Farina <drfarina@gmail.com>:
>> On Tue, Nov 24, 2009 at 10:23 PM, Jeff Davis <pgsql@j-davis.com> wrote:
>>> On Wed, 2009-11-25 at 06:35 +0100, Pavel Stehule wrote:
>>>> I believe so using an "internal" minimalize necessary changes in COPY
>>>> implementation. Using a funcapi needs more work inside COPY -  you
>>>> have to take some functionality from COPY to stream functions.
>>>> Probably the most slow operations is parsing - calling a input
>>>> functions. This is called once every where. Second slow operation is
>>>> reading from network - it is same. So I don't see too much reasons,
>>>> why non internal implementation have to be significant slower than
>>>> your actual implementation. I am sure, so it needs more work.
>>>
>>> I apologize, but I don't understand what you're saying. Can you please
>>> restate with some examples?
>>>
>>> It seems like you're advocating that we move records from a table into a
>>> function using COPY. But that's not what COPY normally does: COPY
>>> normally translates records to bytes or bytes to records.
>>
>> Perhaps what we want is pluggable transformation functions that can
>> format the row any way that is desired, with the current behavior
>> being some default.  Putting COPY TO FUNCTION as submitted aside, what
>> about something like this:
>>
>> COPY foo TO '/tmp/foo' USING postgres_builtin_formatter(csv = true);
>>
>> This is something completely different than what was submitted, so in
>> some aspect:
>>
>> COPY foo TO FUNCTION dblink_send_row USING
>> postgres_builtin_formatter(binary = true);
>>
>> Would compose the two features...
>>
>
> yes - it is two features - and should be solved independently

it and it is not (some thinking) - smarter streams should to
accept/returns tuples. Formating function has sense for text output -
there are input/output formating (text based/bytea based) functions.

I see one possible problem - when formater functions will be row based
- then you cannot generate some prolog and epilog part of file -
(xml).

Pavel

>
> Pavel
>
>> (Again, very, very far from a real syntax suggestion)
>>
>> fdr
>>
>> --
>> Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
>> To make changes to your subscription:
>> http://www.postgresql.org/mailpref/pgsql-hackers
>>
>


pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: LockDatabaseObject()
Next
From: Jeff Davis
Date:
Subject: Re: [PATCH 4/4] Add tests to dblink covering use of COPY TO FUNCTION