Re: Back Slash \ issue - Mailing list pgsql-general

From Bruce Momjian
Subject Re: Back Slash \ issue
Date
Msg-id 20190503140444.yfov3km235ddhdgv@momjian.us
Whole thread Raw
In response to Re: Back Slash \ issue  (Adrian Klaver <adrian.klaver@aklaver.com>)
Responses Re: Back Slash \ issue
List 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@momjian.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 +



pgsql-general by date:

Previous
From: Jeff Janes
Date:
Subject: Re: Starting Postgres when there is no disk space
Next
From: Bruce Momjian
Date:
Subject: Re: Back Slash \ issue