Re: COPY as a set returning function

From: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, David Fetter <david(at)fetter(dot)org>, Merlin Moncure <mmoncure(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Craig Ringer <craig(dot)ringer(at)2ndquadrant(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: COPY as a set returning function
Date: 2017-01-31 17:24:31
Message-ID: CADkLM=fmBVojy0uqD40_H5ozsO5s=gqavc57L=f5XK7DZGuuJw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>
>
> Here is a 4: Refactoring BeginCopyFrom so as instead of a Relation are
> used a TupleDesc, a default expression list, and a relation name. You
> could as well make NextCopyFrom() smarter so as it does nothing if no
> expression contexts are given by the caller, which is the case of your
> function here. To be honest, I find a bit weird to use
> NextCopyFromRawFields when there is already a bunch of sanity checks
> happening in NextCopyFrom(), where you surely want to have them
> checked even for your function.
>
> Looking at the last patch proposed, I find the current patch proposed
> as immature, as rsTupDesc basically overlaps with the relation a
> caller can define in BeginCopyFrom(), so marking this patch as
> "returned with feedback".
> --
> Michael
>

I like that suggestion and will move forward on it. I wasn't sure there
would be support for such a refactoring.

As for the copy from stdin case, Andrew Gierth laid out why that's nearly
impossible to unwind in the network protocol (the act of starting the copy
causes the query result to end before any rows were returned), and that
might make STDIN input a dead issue.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2017-01-31 17:25:47 Re: Speedup twophase transactions
Previous Message Corey Huinker 2017-01-31 17:16:51 Re: \if, \elseif, \else, \endif (was Re: PSQL commands: \quit_if, \quit_unless)