Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1de40z-0000vo-8d for pgsql-bugs@arkaria.postgresql.org; Sat, 05 Aug 2017 18:43:11 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1de2JW-0006l1-Oz for pgsql-bugs@arkaria.postgresql.org; Sat, 05 Aug 2017 16:52:34 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1de2JW-0006kJ-2J for pgsql-bugs@postgresql.org; Sat, 05 Aug 2017 16:52:34 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1de2JT-00074s-CF for pgsql-bugs@postgresql.org; Sat, 05 Aug 2017 16:52:32 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id v75GqSKi001474; Sat, 5 Aug 2017 12:52:28 -0400 From: Tom Lane To: Michael Paquier cc: Nicolas Barbier , PostgreSQL Bugs Subject: Re: \copy produces CSV output that cannot be read by \copy In-reply-to: References: Comments: In-reply-to Michael Paquier message dated "Sat, 05 Aug 2017 18:39:19 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1472.1501951948.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Sat, 05 Aug 2017 12:52:28 -0400 Message-ID: <1473.1501951948@sss.pgh.pa.us> List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Michael Paquier writes: > The format produced by COPY OUT looks fine to me, and can be reloaded > with a plain COPY (not \copy). And you may be interested in this bit > from src/bin/psql/copy.c: > /* > * This code erroneously assumes '\.' on a line alone > * inside a quoted CSV string terminates the \copy. > * > http://www.postgresql.org/message-id/E1TdNVQ-0001ju-GO@wrigleys.postgresq= l.org > */ I wonder if it would improve matters to check for "\." only when copystream =3D=3D pset.cur_cmd_source, that is, only when the copy data is inlined into the SQL stream. That would create an inconsistency between inline and out-of-line data, but it might be a reasonable thing to do anyway. regards, tom lane --=20 Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs