From: Tom Lane <tgl@sss.pgh.pa.us>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: Joe Conway <mail@joeconway.com>
Cc: Färber, Franz-Josef (StMUK) <Franz-Josef.Faerber@stmuk.bayern.de>
Cc: pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>
Subject: Re: COPY TO (query) allows no function arguments
Date: Wed, 10 Mar 2021 11:46:51 -0500
Message-ID: <2107098.1615394811@sss.pgh.pa.us> (raw)
In-Reply-To: <CAKFQuwa9KTE+sYuDzCbbh9Ae8aJRsmTpqs_bOK-6XnMfYmV7RA@mail.gmail.com>
References: <609326d4d6854085aeb909ae564d4ccb@stmuk.bayern.de>
<eda708fe-a55c-0df5-8c64-cae6c9eeb54e@joeconway.com>
<CAKFQuwa9KTE+sYuDzCbbh9Ae8aJRsmTpqs_bOK-6XnMfYmV7RA@mail.gmail.com>
"David G. Johnston" <david.g.johnston@gmail.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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, david.g.johnston@gmail.com, mail@joeconway.com, Franz-Josef.Faerber@stmuk.bayern.de, pgsql-bugs@lists.postgresql.org
Subject: Re: COPY TO (query) allows no function arguments
In-Reply-To: <2107098.1615394811@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox