Re: [PATCH 4/4] Add tests to dblink covering use of COPY TO FUNCTION
Daniel Farina <drfarina@gmail.com>
From: Daniel Farina <drfarina@gmail.com>
To: David Fetter <david@fetter.org>
Cc: Andrew Dunstan <andrew@dunslane.net>, Jeff Davis <pgsql@j-davis.com>, Pavel Stehule <pavel.stehule@gmail.com>, Hannu Krosing <hannu@krosing.net>, Greg Smith <greg@2ndquadrant.com>, Robert Haas <robertmhaas@gmail.com>, Daniel Farina <dfarina@truviso.com>, pgsql-hackers@postgresql.org
Date: 2009-11-27T02:30:08Z
Lists: pgsql-hackers
On Thu, Nov 26, 2009 at 6:13 PM, David Fetter <david@fetter.org> wrote: > It'd be nice to make this available to the next revision of DBI-Link > and it'll be pretty handy for our SQL/MED whenever that happens. Okay, so this thread sort of wandered into how we could refactor other elements of COPY. Do we have a good sense on what we should do to the current patch (or at least the idea represented by it) to get it into a committable state within finite time? I think adding a bytea and/or text mode is once such improvement...I am still reluctant to give up on INTERNAL because the string buffer passed in the INTERNAL scenario is ideal for C programmers -- the interface is even simpler than dealing with varlena types. But I agree that auxiliary modes should exist to enable easier hacking. The thorniest issue in my mind is how state can be initialized retained and/or modified between calls to the bytestream-acceptance function. Arguably it is already in a state where it is no worse than dblink, which itself has a global hash table to manage state. Also, if you look carefully at the dblink test suite I submitted, you'll see an interesting trick: one can COPY from multiple sources consecutively to a single COPY on a remote node when in text mode (binary mode has a header that cannot be so neatly catenated). This is something that's pretty hard to enable with any automatic startup-work-cleanup approach. fdr