Re: Is it possible to set end-of-data marker for COPY statement.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Junfeng Yang <yjerome(at)vmware(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Is it possible to set end-of-data marker for COPY statement.
Date: 2020-09-01 18:01:06
Message-ID: 141882.1598983266@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Bruce Momjian <bruce(at)momjian(dot)us> writes:
> On Tue, Sep 1, 2020 at 06:14:45AM +0000, Junfeng Yang wrote:
>> Data in file "/tmp/data".
>>
>> 122,as\.d,adad
>> 133,sa dad,adadad

> So, you are using comma as the delimiter, but have \. (backslash-period)
> as a data value. You need to double-up backslashes in your input data,
> no matter what is after the backslash. You just happen to hit backslash
> period, but other things like \N could cause problems --- literal
> backslashes have to be doubled.

As mentioned upthread, using CSV format might work better. In CSV
you aren't necessarily stuck with backslash being treated as an
escape character.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Kyotaro Horiguchi 2020-09-02 01:50:33 Re: How bad is using queries with thousands of values for operators IN or ANY?
Previous Message Bruce Momjian 2020-09-01 17:25:50 Re: Is it possible to set end-of-data marker for COPY statement.

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2020-09-01 18:15:27 Re: ALTER TABLE .. DETACH PARTITION CONCURRENTLY
Previous Message Bruce Momjian 2020-09-01 17:25:50 Re: Is it possible to set end-of-data marker for COPY statement.