<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.