Re: [BUGS] \copy produces CSV output that cannot be read by \copy
От | Michael Paquier |
---|---|
Тема | Re: [BUGS] \copy produces CSV output that cannot be read by \copy |
Дата | |
Msg-id | CAB7nPqQvFQz=C2q8aTs5YGRe==796EwnjcmjXmW4J4McZUF8Ow@mail.gmail.com обсуждение исходный текст |
Ответ на | [BUGS] \copy produces CSV output that cannot be read by \copy (Nicolas Barbier <nicolas.barbier@gmail.com>) |
Ответы |
Re: [BUGS] \copy produces CSV output that cannot be read by \copy
|
Список | pgsql-bugs |
On Fri, Aug 4, 2017 at 2:38 PM, Nicolas Barbier <nicolas.barbier@gmail.com> wrote: > Analysis: I think that neither the writing nor the reading is incompatible > with the documentation. Rather, there doesn’t seem to be a way to write such > values to CSV that will be read back correctly (or at least I couldn‘t find > such a way), as the reader always stops when encountering \. on a line by > itself, and because there doesn’t seem to be a way to escape such a value in > a way that wouldn’t produce a \. on a line by itself. 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 */ if(strcmp(buf, "\\.\n") == 0 || strcmp(buf, "\\.\r\n") == 0) { copydone = true; break; } postgresql.org is offline now, and I don't have this thread at hand, but I guess that the answer is there... -- Michael -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs
В списке pgsql-bugs по дате отправления: