From: | Corey Huinker <corey(dot)huinker(at)gmail(dot)com> |
---|---|
To: | Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com> |
Cc: | 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-30 18:05:55 |
Message-ID: | CADkLM=eOv4LGOFUO=ir_nZvhGjPoTwndiiM9UZc2DH_Pb6Ldcg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Fri, Jan 27, 2017 at 9:42 PM, Peter Eisentraut <
peter(dot)eisentraut(at)2ndquadrant(dot)com> wrote:
> On 1/25/17 8:51 PM, Corey Huinker wrote:
> > # select * from copy_srf('echo "x\ty"',true) as t(x text, y text);
>
> I find these parameters weird. Just looking at this, one has no idea
> what the "true" means. Why not have a "filename" and a "program"
> parameter and make them mutually exclusive?
It was done that way to match the parameters of BeginCopyFrom() and it
could easily be changed.
I suppose I could have written it as:
select * from copy_srf(filename => 'echo "x\ty"', is_program => true) as
t(x text, y text);
But this goes to the core of this patch/poc: I don't know where we want to
take it next.
Options at this point are:
1. Continue with a SRF, in which case discussions about parameters are
completely valid.
2. Add a RETURNING clause to COPY. This would dispense with the parameters
problem, but potentially create others.
3. Add the TupDesc parameter to BeginCopyFrom, make sure all data
structures are visible to an extension, and call it a day. If someone wants
to write an extension that makes their own copy_srf(), they can.
4. Someone else's better idea.
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2017-01-30 18:10:58 | Re: pgsql: test_pg_dump TAP test whitespace cleanup |
Previous Message | Robert Haas | 2017-01-30 18:02:03 | Re: Proposal : For Auto-Prewarm. |