pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Michael Paquier <michael.paquier@gmail.com>
Cc: Nicolas Barbier <nicolas.barbier@gmail.com>
Cc: PostgreSQL Bugs <pgsql-bugs@postgresql.org>
Subject: Re: \copy produces CSV output that cannot be read by \copy
Date: Sat, 05 Aug 2017 12:52:28 -0400
Message-ID: <1473.1501951948@sss.pgh.pa.us> (raw)
In-Reply-To: <CAB7nPqQvFQz=C2q8aTs5YGRe==796EwnjcmjXmW4J4McZUF8Ow@mail.gmail.com>
References: <CAP-rdTbO35=U0+2Dn-i9FAYvau7Lm6Athd29KZ4sS+kDs21tLg@mail.gmail.com>
	<CAB7nPqQvFQz=C2q8aTs5YGRe==796EwnjcmjXmW4J4McZUF8Ow@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

Michael Paquier <michael.paquier@gmail.com> 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.postgresql.org
>                      */

I wonder if it would improve matters to check for "\." only when
copystream == 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


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (5+ messages)  latest in thread

Message-ID: <1473.1501951948@sss.pgh.pa.us>
Permalink:  ../1473.1501951948@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1473.1501951948@sss.pgh.pa.us

 · 

reply

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, michael.paquier@gmail.com, nicolas.barbier@gmail.com
  Subject: Re: \copy produces CSV output that cannot be read by \copy
  In-Reply-To: <1473.1501951948@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