Re: Back Slash \ issue

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:04:44
Message-ID: 20190503140444.yfov3km235ddhdgv@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, May 3, 2019 at 06:55:55AM -0700, Adrian Klaver wrote:
> On 5/2/19 10:48 PM, Guntry Vinod wrote:
>
> Please do not top post. Inline/bottom posting is the preferred style on this
> list.
> > Hi Team,
> >
> > We are using the below command
> >
> > COPY <<TableName>> from 'C:\Data_Dump\ABC.txt' DELIMITER '|';
>
> The above shows what you are doing on the input into Postgres.
> We still do not know how you are dumping the data from DB2.
>
> In what format are you dumping the DB2 data and with what specifications
> e.g. quoting?

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.

The bottom line is that you are going to need to double the backslashes
unless you move to CSV mode.

--
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 +

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2019-05-03 14:10:01 Re: Back Slash \ issue
Previous Message Jeff Janes 2019-05-03 13:56:23 Re: Starting Postgres when there is no disk space