Re: Back Slash \ issue

Поиск
Список
Период
Сортировка
От Melvin Davidson
Тема Re: Back Slash \ issue
Дата
Msg-id CANu8FiwipQh-bi75d8RWsq3975-v0DEC9ESVmM3QoTzRnUFDRQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Back Slash \ issue  (Rob Sargent <robjsargent@gmail.com>)
Список pgsql-general
Have you tried adding
ESCAPE '\' to the PostgreSQL COPY command?

https://www.postgresql.org/docs/10/sql-copy.html

On Thu, May 2, 2019 at 12:54 PM Rob Sargent <robjsargent@gmail.com> wrote:

On 5/2/19 9:19 AM, Guntry Vinod wrote:
> Hi Adrian\Kiran,
>
> Below is the issue.
>
> We are migrating from Db2 to Postgre.
>
> The Db2 dump consists of back Slash \ with in the data [dump] , but postgre is not escaping the Slash.
>
> For example if name consist of Vinod\G after the inserting the dump the value in postgre is VinodG where as I need it as Vinod\G.

Have you tried somlething like

     sed 's/\\/\\\\/g' db2dump > db2dump.fixed

>
> Since the dump is huge data I can't replace \  within the data to escape Slash.
>
> We are using import utility provided by Postgre.
>
> Can you please give me any solution in this regard?.
>
> @kiran-let me also try solution you provided in the below mail.
>
> Regards,
> Vinod
> _______________________________________
> From: Adrian Klaver [adrian.klaver@aklaver.com]
> Sent: 02 May 2019 20:04
> To: ravikrishna@mail.com; Guntry Vinod
> Cc: pgsql-general@postgresql.org; Venkatamurali Krishna Gottuparthi; Biswa Ranjan Dash
> Subject: Re: Back Slash \ issue
>
> On 5/2/19 7:30 AM, ravikrishna@mail.com wrote:
>>   > We have dump from DB2 and trying to upload it Postgre.
>> DB2 export command has an option to export it as CSV which quotes data
>> so that any embedded
>> lines or special characters inside the data is treated fine.  Does the
>> csv format has quotes enclosing it ?
> Please show the command you use to import into Postgres.
> Also the error message you get.
>
>
> --
> Adrian Klaver
> adrian.klaver@aklaver.com
> ============================================================================================================================
>
> 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.
>
> ============================================================================================================================
>
>
>




--
Melvin Davidson
Maj. Database & Exploration Specialist

Universe Exploration Command – UXC

Employment by invitation only!

В списке pgsql-general по дате отправления:

Предыдущее
От: Mark Zellers
Дата:
Сообщение: RE: Migrating an application with Oracle temporary tables
Следующее
От: Sabit Nepal
Дата:
Сообщение: Postgres using inefficient query plan when using OR filter, usescorrect indices when using IN clause