From: Tom Lane <tgl@sss.pgh.pa.us>
To: Bruce Momjian <bruce@momjian.us>
Cc: Junfeng Yang <yjerome@vmware.com>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@lists.postgresql.org>
Subject: Re: Is it possible to set end-of-data marker for COPY statement.
Date: Tue, 01 Sep 2020 14:01:06 -0400
Message-ID: <141882.1598983266@sss.pgh.pa.us> (raw)
In-Reply-To: <20200901172550.GY13613@momjian.us>
References: <DM5PR0501MB3880CB81067E14F9C78FA28BCC2E0@DM5PR0501MB3880.namprd05.prod.outlook.com>
<20200901172550.GY13613@momjian.us>
Bruce Momjian <bruce@momjian.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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, bruce@momjian.us, yjerome@vmware.com, pgsql-hackers@lists.postgresql.org
Subject: Re: Is it possible to set end-of-data marker for COPY statement.
In-Reply-To: <141882.1598983266@sss.pgh.pa.us>
References: <DM5PR0501MB3880CB81067E14F9C78FA28BCC2E0@DM5PR0501MB3880.namprd05.prod.outlook.com> <20200901172550.GY13613@momjian.us> <141882.1598983266@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox