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

From Rob Sargent
Subject Re: Back Slash \ issue
Date
Msg-id a7be1a16-fb0b-3a68-f40e-243853eeaf87@gmail.com
Whole thread Raw
In response to RE: Back Slash \ issue  (Guntry Vinod <GV00619735@TechMahindra.com>)
List pgsql-general
On 5/3/19 10:05 AM, Guntry Vinod wrote:
> Hi Team,
>
> Here we go. I will give the problem in more detail
>
> Step 1:We get the dump from DB2 and this dump is flat file which can be csv,txt
> Step2:There is table in PostGre where we are suppose  to upload the dump
> Step3:We are using copy command to upload dump to the table using (COPY <<TableName>> from 'C:\Data_Dump\ABC.txt'
DELIMITER'|';  )
 
> Step 4:In the above step we are using delimiter because the data is separated (:) in the flat which we have received
fromthe flat file
 
>
> Problem Statement:We are able to upload the data from the flat file which we got from the DB2 but few data the data
consistof  " \".For example if the CustomerName is Vinod\G in the flat file ,we expect the same data in PostGre  table
forCustomerName as Vinod\G but we see VinodG(slash is missed).
 
>
> Possible Solution: We can replace "\" with "\\" but if the file is in too large we cannot open it(we can replace if
thefile is medium or small)
 
>
> Expectation: We need a command or utility which can upload the data as it is (for example if Vinod\G then we should
seein PostGre as Vinod\G but not VinodG)
 
>
>
So everything works except the backslashes disappear, correct? As many 
have said all you need to do is double the backslashes, and apparently 
you done that on small files.  How have you done that? Perhaps with an 
editor?  For the large files you must use a tool (perl awk, even a 
trivial C program) to double the backslashes.





pgsql-general by date:

Previous
From: Guntry Vinod
Date:
Subject: RE: Back Slash \ issue
Next
From: Igal Sapir
Date:
Subject: Re: Starting Postgres when there is no disk space