Re: COPY as a set returning function - Mailing list pgsql-hackers

From Craig Ringer
Subject Re: COPY as a set returning function
Date
Msg-id CAMsr+YEmfEGsRTtfJKDs5Mtqg3CbU5Ao_-rdi0FBJPvJ3y4npQ@mail.gmail.com
Whole thread Raw
In response to COPY as a set returning function  (Corey Huinker <corey.huinker@gmail.com>)
Responses Re: COPY as a set returning function  (Corey Huinker <corey.huinker@gmail.com>)
List pgsql-hackers
<p dir="ltr">On 15 Oct. 2016 04:56, "Corey Huinker" <<a
href="mailto:corey.huinker@gmail.com">corey.huinker@gmail.com</a>>wrote:<p dir="ltr">> I would like to make COPY
itselfa SRF. That's a bit beyond my capabilities, so if that is the route we want to go, I will need help.<br />
><br/> > The syntax would probably look like this (new bits in bold):<br /> ><br /> >> WITH my_copy  AS
(<br/> >>     COPY FROM 'example.csv' TO RESULT SET(c1 text, c2 integer, dummy1 text, dummy2 text, c5 date) WITH
(FORMATCSV)<br /> >>     RETURNING c1, c2, c3<br /> >> )<p dir="ltr">Strong -1 from me on this approach.
OurCTE implementation materializes everything so this is no better than COPYing to a temp table.<p dir="ltr">Not unless
youplan to fix that (and figure out the backward compatibility issues since the bug is documented as a feature) or
implementRETURNING in subqueries... I'd go for the function. 

pgsql-hackers by date:

Previous
From: Fabien COELHO
Date:
Subject: Re: [PATCH] pgpassfile connection option
Next
From: Jeff Janes
Date:
Subject: postgres_fdw super user checks