From: | Bruce Momjian <bruce(at)momjian(dot)us> |
---|---|
To: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> |
Cc: | Guntry Vinod <GV00619735(at)TechMahindra(dot)com>, "ravikrishna(at)mail(dot)com" <ravikrishna(at)mail(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>, Venkatamurali Krishna Gottuparthi <VG00114307(at)TechMahindra(dot)com>, Biswa Ranjan Dash <BD00617837(at)TechMahindra(dot)com> |
Subject: | Re: Back Slash \ issue |
Date: | 2019-05-03 14:10:01 |
Message-ID: | 20190503141001.pow4wl46qaapba6h@momjian.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Fri, May 3, 2019 at 10:04:44AM -0400, Bruce Momjian wrote:
> On thing the original poster might be missing is that the copy DELIMITER
> is used between fields, while backslash is used as an escape before a
> single character. While it might be tempting to try to redefine the
> escape character with the copy ESCAPE keyword, that keyword only works
> in CSV mode.
>
> The Postgres COPY format is very reliable and able to dump/reload _any_
> data sequence. Many commercial data dump implementations are simpler
> but are not able to be as reliable.
For example, if you are using | as a delimiter, how do you represent a
literal | in the data? You have to use an escape character before it,
and that is what backslash does, and if you have a backslash in your
data, you have to use a backslash before it too. CSV has a similar
problem with double-quotes in double-quoted strings, and this is handled
by default by using two double-quotes.
--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ As you are, so once was I. As I am, so you will be. +
+ Ancient Roman grave inscription +
From | Date | Subject | |
---|---|---|---|
Next Message | Ravi Krishna | 2019-05-03 14:35:05 | Re: Back Slash \ issue |
Previous Message | Bruce Momjian | 2019-05-03 14:04:44 | Re: Back Slash \ issue |