From: | Craig Ringer <craig(dot)ringer(at)2ndquadrant(dot)com> |
---|---|
To: | Corey Huinker <corey(dot)huinker(at)gmail(dot)com> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Subject: | Re: COPY as a set returning function |
Date: | 2016-10-16 13:01:44 |
Message-ID: | CAMsr+YEmfEGsRTtfJKDs5Mtqg3CbU5Ao_-rdi0FBJPvJ3y4npQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 15 Oct. 2016 04:56, "Corey Huinker" <corey(dot)huinker(at)gmail(dot)com> wrote:
> I would like to make COPY itself a SRF. That's a bit beyond my
capabilities, so if that is the route we want to go, I will need help.
>
> The syntax would probably look like this (new bits in bold):
>
>> WITH my_copy AS (
>> COPY FROM 'example.csv' TO RESULT SET(c1 text, c2 integer, dummy1
text, dummy2 text, c5 date) WITH (FORMAT CSV)
>> RETURNING c1, c2, c3
>> )
Strong -1 from me on this approach. Our CTE implementation materializes
everything so this is no better than COPYing to a temp table.
Not unless you plan to fix that (and figure out the backward compatibility
issues since the bug is documented as a feature) or implement RETURNING in
subqueries... I'd go for the function.
From | Date | Subject | |
---|---|---|---|
Next Message | Jeff Janes | 2016-10-16 18:33:26 | postgres_fdw super user checks |
Previous Message | Fabien COELHO | 2016-10-16 10:09:27 | Re: [PATCH] pgpassfile connection option |