Re: COPY TO (query) allows no function arguments

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Joe Conway <mail(at)joeconway(dot)com>, Färber, Franz-Josef (StMUK) <Franz-Josef(dot)Faerber(at)stmuk(dot)bayern(dot)de>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: COPY TO (query) allows no function arguments
Date: 2021-03-10 16:46:51
Message-ID: 2107098.1615394811@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> If COPY itself can be parameterized/prepared (I'm unsure and not able to
> test right now) then it should be able to accept variables when used in a
> function - within the rules for variable substitution.

COPY is a utility command, so it doesn't accept parameters. Basically
only the big four DML commands (SELECT/INSERT/UPDATE/DELETE) can take
parameters. For everything else, you've got to build a string and
EXECUTE it, as Joe illustrated.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Bruce Momjian 2021-03-10 17:14:53 Re: BUG #16902: FileOpen in pgadmin 4 V5.0
Previous Message David G. Johnston 2021-03-10 15:45:07 Re: COPY TO (query) allows no function arguments