Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lK0PL-0002hN-P9 for pgsql-bugs@arkaria.postgresql.org; Wed, 10 Mar 2021 15:05:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lK0PJ-0004jh-Ig for pgsql-bugs@arkaria.postgresql.org; Wed, 10 Mar 2021 15:05:53 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lK08l-00060e-Tu for pgsql-bugs@lists.postgresql.org; Wed, 10 Mar 2021 14:48:48 +0000 Received: from mailout109.bayern.de ([195.200.70.109]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lK08e-0003rI-G6 for pgsql-bugs@lists.postgresql.org; Wed, 10 Mar 2021 14:48:46 +0000 Received: from post28.bybn.de ([10.197.20.28]) by mailout109.bayern.de (8.15.2/8.15.2) with ESMTP id 12AEmbPD003892 for ; Wed, 10 Mar 2021 15:48:37 +0100 Received: from ZMX-EXP4-P17745.max.bayern.de (ZMX-EXP4-P17745.max.bayern.de [10.173.241.169]) by post28.bybn.de (8.14.4/8.14.4) with ESMTP id 12AEmY1p013324 for ; Wed, 10 Mar 2021 15:48:36 +0100 (envelope-from Franz-Josef.Faerber@stmuk.bayern.de) Received: from ZMX-EXPB-P17750.max.bayern.de (10.173.241.172) by ZMX-EXP4-P17745.max.bayern.de (10.173.241.169) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Wed, 10 Mar 2021 15:48:34 +0100 Received: from ZMX-EXPB-P17750.max.bayern.de (10.173.241.172) by ZMX-EXPB-P17750.max.bayern.de (10.173.241.172) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Wed, 10 Mar 2021 15:48:34 +0100 Received: from ZMX-EXPB-P17750.max.bayern.de ([10.173.241.172]) by ZMX-EXPB-P17750.max.bayern.de ([10.173.241.172]) with mapi id 15.01.2176.009; Wed, 10 Mar 2021 15:48:34 +0100 From: =?iso-8859-1?Q?F=E4rber=2C_Franz-Josef_=28StMUK=29?= To: "pgsql-bugs@lists.postgresql.org" Subject: COPY TO (query) allows no function arguments Thread-Topic: COPY TO (query) allows no function arguments Thread-Index: AdcVu5AD15oTm+dkTfm9qszc3pJQEw== Date: Wed, 10 Mar 2021 14:48:34 +0000 Message-ID: <609326d4d6854085aeb909ae564d4ccb@stmuk.bayern.de> Accept-Language: de-DE, en-US Content-Language: de-DE X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.171.82.81] Content-Type: multipart/alternative; boundary="_000_609326d4d6854085aeb909ae564d4ccbstmukbayernde_" MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --_000_609326d4d6854085aeb909ae564d4ccbstmukbayernde_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hello all, it is as simple as the subject says: The COPY TO (query) statement does not allow the passing of function argume= nts - 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 =BBmyparam=AB existiert nicht Wobei: PL/pgSQL-Funktion a(text) Zeile 3 bei SQL-Anweisung Sorry, my installation is German. This roughly translates to "column mypara= m does not exist". I am using Postgres 13. Regards, Franz-Josef F=E4rber --_000_609326d4d6854085aeb909ae564d4ccbstmukbayernde_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable

Hello all,

 

it is as simple as the subject says:

 

The COPY TO (query) statement does not allow the pas= sing 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

     &= nbsp; COPY (SELECT myparam) TO '/= tmp/a.txt';

END;

$func$

 

SELECT a('b');

 

… will fail with

 

SQL-Fehler [42703]: FEHLER: Spalte =BBmyparam=AB exi= stiert nicht

  Wobei: PL/pgSQL-Funktion a(text) Zeile 3 bei = SQL-Anweisung

 

Sorry, my installation is German. This roughly trans= lates to „column myparam does not exist“.

 

I am using Postgres 13.

 

 

Regards,

Franz-Josef F=E4rber

--_000_609326d4d6854085aeb909ae564d4ccbstmukbayernde_--