On 12 December 2016 at 23:29, Robert Haas <robertmh...@gmail.com> wrote: > On Mon, Dec 12, 2016 at 10:02 AM, Craig Ringer > <craig.rin...@2ndquadrant.com> wrote: >> On 12 Dec. 2016 21:55, "Robert Haas" <robertmh...@gmail.com> wrote: >> On Sun, Dec 11, 2016 at 5:38 AM, Andrew Borodin <boro...@octonica.com> >> wrote: >>> 1. As far as I can see, we connot use COPY FROM STDIN in bg session? >>> Since one of purposes is to orchestrate transactions, may be that >>> would be valuable. >> >> A background worker has no client connection, so what would COPY FROM STDIN >> do? >> >> It doesn't make sense. But a bgworker may well want to supply input to COPY. >> A COPY FROM CALLBACK of COPY FROM FILEDESC or whatever. > > That's kinda weird, though. I mean, you don't need to go through all > of the COPY code just to call heap_multi_insert() or whatever, do you? > You can hand-roll whatever you need there.
And fire triggers and constraint checks if necessary, update indexes, etc. But yeah. The original idea with logical rep was to get COPY-format data from the upstream when initializing a table, and apply it via COPY in a bgworker. I think that's changed in favour of another approach in logical rep now, but thought it was worth mentioning as something it might make sense for someone to want to do. -- Craig Ringer http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-hackers mailing list (firstname.lastname@example.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers