Re: Allow COPY to use parameters

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: David Fetter <david(at)fetter(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PG Hackers <pgsql-hackers(at)postgresql(dot)org>, Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
Subject: Re: Allow COPY to use parameters
Date: 2016-05-24 20:55:50
Message-ID: CAHyXU0zA9x7YTthSZJHMG41q5u4TBeF_90WAbXMppsT1yATfog@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, May 24, 2016 at 3:42 PM, David Fetter <david(at)fetter(dot)org> wrote:
> On Tue, May 24, 2016 at 02:16:40PM -0400, Tom Lane wrote:
>> David Fetter <david(at)fetter(dot)org> writes:
>> > Per discussion on IRC and some test code, COPY can't take parameters
>> > in a PREPARE, which feature would make it even more useful.
>>
>> Uh, what?
>>
>> regression=# prepare foo as copy c from stdin;
>> ERROR: syntax error at or near "copy"
>> LINE 1: prepare foo as copy c from stdin;
>> ^
>>
>> Passing parameters into a utility statement of any stripe is a
>> pretty considerable project, IIRC; the infrastructure isn't there.
>
> Maybe it should be, at least for some of the utility statements.
>
> Please find attached a patch which, according to Andrew Gierth, its
> author, just barely qualifies as a PoC. Yes, it's had to break a
> couple of messages in the regression tests.

Hm, what's the use case preparing COPY? Note, the biggest pain point
I have with COPY is not being able to parameterize the filename
argument. That's pretty easily worked around with a plpgsql wrapper
however.

merlin

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kevin Grittner 2016-05-24 21:09:27 Re: [HACKERS] Re: pgsql: Avoid extra locks in GetSnapshotData if old_snapshot_threshold <
Previous Message Andres Freund 2016-05-24 20:54:51 Re: Re: [COMMITTERS] pgsql: Avoid extra locks in GetSnapshotData if old_snapshot_threshold <