From: Färber, Franz-Josef (StMUK) <Franz-Josef.Faerber@stmuk.bayern.de>
To: pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>
Subject: COPY TO (query) allows no function arguments
Date: Wed, 10 Mar 2021 14:48:34 +0000
Message-ID: <609326d4d6854085aeb909ae564d4ccb@stmuk.bayern.de> (raw)
Hello all,
it is as simple as the subject says:
The COPY TO (query) statement does not allow the passing of function arguments - is this by intent or a bug?
Minimal working example:
CREATE OR REPLACE FUNCTION a(myparam text)
RETURNS void LANGUAGE plpgsql AS $func$
BEGIN
COPY (SELECT myparam) TO '/tmp/a.txt';
END;
$func$
SELECT a('b');
... will fail with
SQL-Fehler [42703]: FEHLER: Spalte »myparam« existiert nicht
Wobei: PL/pgSQL-Funktion a(text) Zeile 3 bei SQL-Anweisung
Sorry, my installation is German. This roughly translates to "column myparam does not exist".
I am using Postgres 13.
Regards,
Franz-Josef Färber
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: Franz-Josef.Faerber@stmuk.bayern.de, pgsql-bugs@lists.postgresql.org
Subject: Re: COPY TO (query) allows no function arguments
In-Reply-To: <609326d4d6854085aeb909ae564d4ccb@stmuk.bayern.de>
* 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