Re: Back Slash \ issue

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Guntry Vinod <GV00619735(at)TechMahindra(dot)com>, Ravi Krishna <ravikrishna(at)mail(dot)com>, Michael Nolan <htfoot(at)gmail(dot)com>
Cc: "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 16:09:28
Message-ID: 7af20b60-b406-c2e9-470a-76fc5c8296b9@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 5/3/19 9: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

The above is what we need information on:

1) Is it output as CSV or text?

2) What are the parameters used to output the data in either case?. In
other words, is string quoting used, the field delimiter, etc.

> 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 from the 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 consist of " \".For example if the CustomerName is Vinod\G in the flat file ,we expect the same data in PostGre table for CustomerName 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 the file 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 see in PostGre as Vinod\G but not VinodG)
>
> Hope Iam detail this time :-)
>
> Regards,
> Vinod
>
>
>
>
> -----Original Message-----
> From: Ravi Krishna <ravikrishna(at)mail(dot)com>
> Sent: Friday, May 3, 2019 8:43 PM
> To: Michael Nolan <htfoot(at)gmail(dot)com>
> Cc: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>; Guntry Vinod <GV00619735(at)TechMahindra(dot)com>; 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
>
>>
>> I don't think we've seen enough representative data to know exactly what the backslash is doing. It doesn't appear to be an escape, based on the sole example I've seen it appears to be a data separator between first name and last name.
>>
>> It seems increasingly likely to me that you might not be in a position where the COPY command in PostgreSQL can handle loading the database, at least not without some help. You might have to write a program to clean up the data and format it for PostgreSQL.
>>
>> I've spent a lot of time over the years migrating data from one platform to another, you have to know EXACTLY what data you currently have and what format you need it turned into before you can figure out how to do the transformation.
>> --
>> Mike Nolan
>
> Fully agreed. I have informed Guntry via email that he has to provide more information before we can help further.
> ============================================================================================================================
>
> Disclaimer: This message and the information contained herein is proprietary and confidential and subject to the Tech Mahindra policy statement, you may review the policy at http://www.techmahindra.com/Disclaimer.html <http://www.techmahindra.com/Disclaimer.html> externally http://tim.techmahindra.com/tim/disclaimer.html <http://tim.techmahindra.com/tim/disclaimer.html> internally within TechMahindra.
>
> ============================================================================================================================
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2019-05-03 16:17:19 Re: Back Slash \ issue
Previous Message Igal Sapir 2019-05-03 16:09:15 Re: Starting Postgres when there is no disk space