Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gUbUQ-0008FN-LA for pgsql-bugs@arkaria.postgresql.org; Wed, 05 Dec 2018 18:01:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gUbUP-0004uK-5b for pgsql-bugs@arkaria.postgresql.org; Wed, 05 Dec 2018 18:01:37 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gUbUO-0004uC-Vi for pgsql-bugs@lists.postgresql.org; Wed, 05 Dec 2018 18:01:37 +0000 Received: from mail.verite.pro ([185.16.44.216]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gUbUE-0006JG-B2 for pgsql-bugs@lists.postgresql.org; Wed, 05 Dec 2018 18:01:36 +0000 Received: from genius-map.net (verite.pro [195.154.189.246]) by mail.verite.pro (Postfix) with ESMTP id 120F38C0233; Wed, 5 Dec 2018 18:56:45 +0100 (CET) Received: by genius-map.net (Postfix, from userid 1001) id 4767138A2957; Wed, 5 Dec 2018 19:01:24 +0100 (CET) Content-Type: text/plain; charset="iso-8859-15" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: BUG #15535: psql: \copy: parse error at... From: "Daniel Verite" To: "Tom Lane" Cc: "David G. Johnston" ,"Voillequin, Jean-Marc" ,"pgsql-bugs@lists.postgresql.org" In-Reply-To: <6309.1544031175@sss.pgh.pa.us> Date: Wed, 05 Dec 2018 19:01:19 +0100 Message-Id: <05a4c411-66fa-4bd0-bf80-98041a87c8de@manitou-mail.org> X-Mailer: Manitou v1.7.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Tom Lane wrote: > Yeah, that is an issue all right. It occurs to me that for the COPY TO > side, we don't really need any new command: we could just make \g work > for that case. (Testing, it seems that plain "\g" works fine already, > but "\g foo" fails to redirect the COPY output, which seems to me to > be arguably a bug as well as lack of useful functionality.) >=20 > That approach does nothing for COPY FROM, though. On the other hand, > it's not needed nearly as bad for COPY FROM, since you can't put a > giant sub-SELECT into that. Agreed. I will look into the problem of COPY OUT with \g filename if you don't beat me to it. Concerning \copyfrom, the most obvious use case is when the filename has to be a variable, which \copy doesn't allow for. But this one might be better solved by just improving \copy. Best regards, --=20 Daniel V=E9rit=E9 PostgreSQL-powered mailer: http://www.manitou-mail.org Twitter: @DanielVerite