RE: Back Slash \ issue

From: Guntry Vinod <GV00619735(at)TechMahindra(dot)com>
To: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Cc: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, "ravikrishna(at)mail(dot)com" <ravikrishna(at)mail(dot)com>, 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 08:45:02
Message-ID: dafc4802660b4746b9c96b7a576b5162@HYDEXCHMBX003.TechMahindra.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Andrew,

So you mean to say we need to replace \\ in data. If so the data what we receive is huge chunk(we cannot open in notepad++ also) .

If we can pass the CSV instead of .txt or any other format. Do we have any solution. if Yes Can you please give me some example.

Many Thanks,
Vinod

-----Original Message-----
From: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
Sent: Friday, May 3, 2019 1:37 PM
To: Guntry Vinod <GV00619735(at)TechMahindra(dot)com>
Cc: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>; ravikrishna(at)mail(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

>>>>> "Guntry" == Guntry Vinod <GV00619735(at)TechMahindra(dot)com> writes:

Guntry> Hi Team,
Guntry> We are using the below command

Guntry> COPY <<TableName>> from 'C:\Data_Dump\ABC.txt' DELIMITER '|';

COPY in postgresql expects one of two data formats; since you did not specify CSV, in this case it's expecting the default postgresql format which requires the use of \ for escapes like \r, \n, \t, \\, \012 and for the default NULL specification of \N.

If you use this format it is therefore your responsibility to ensure that any literal \ characters in the data are escaped as \\, and that any literal appearance of the delimiter character or a newline is also escaped.

See https://www.postgresql.org/docs/current/sql-copy.html under "Text format".

--
Andrew (irc:RhodiumToad)
============================================================================================================================

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.

============================================================================================================================

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Matthias Apitz 2019-05-03 09:01:51 Re: Back Slash \ issue
Previous Message Andrew Gierth 2019-05-03 08:07:03 Re: Back Slash \ issue