Re: [PATCH 4/4] Add tests to dblink covering use of COPY TO FUNCTION
От | Daniel Farina |
---|---|
Тема | Re: [PATCH 4/4] Add tests to dblink covering use of COPY TO FUNCTION |
Дата | |
Msg-id | 7b97c5a40911240256n3ef924absff51e92523b129d7@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: [PATCH 4/4] Add tests to dblink covering use of COPY TO FUNCTION (Daniel Farina <drfarina@gmail.com>) |
Ответы |
Re: [PATCH 4/4] Add tests to dblink covering use of COPY
TO FUNCTION
|
Список | pgsql-hackers |
On Tue, Nov 24, 2009 at 2:51 AM, Daniel Farina <drfarina@gmail.com> wrote: > On Tue, Nov 24, 2009 at 2:50 AM, Hannu Krosing <hannu@2ndquadrant.com> wrote: >> Can't you use existing aggregate function design ? >> >> CREATE AGGREGATE name ( input_data_type [ , ... ] ) ( >> SFUNC = sfunc, >> STYPE = state_data_type >> [ , FINALFUNC = ffunc ] >> [ , INITCOND = initial_condition ] >> [ , SORTOP = sort_operator ] >> ) > > Actually, yes. I just thought that this was an idea so crazy that no > one would like it. Oh, and the other elephant in the room: error handling. How to handle error conditions...try/catch/finally type stuff. Aggregates do not necessarily provide a slot for this one. I did consider using aggregates though, but somehow it felt to me like "I need at least a three-tuple, why not fish around for any random bundling of three functions..." After all, I would not want to actually call the nodeAgg stuff to apply the function anyway...so it'd basically be abused as a three-tuple of functions. Also, what if you wanted, say, replace the mechanism for COPY TO 'file'? It'd be nice to make the following interaction (which uses some implied global variables) not use such global variables: BEGIN; select open_file('/tmp/file', 'w+'); copy foo to function write_to_file; -- what happens here if COPY aborts? Does the transaction being in the error state mean that files will not get closed? select close_file(); COMMIT; fdr
В списке pgsql-hackers по дате отправления: