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

2020-09-01 Thread Tom Lane
Bruce Momjian writes: > On Tue, Sep 1, 2020 at 06:14:45AM +, 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 in

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

2020-09-01 Thread Bruce Momjian
On Tue, Sep 1, 2020 at 06:14:45AM +, Junfeng Yang wrote: > Hi hackers, > > As described in the doc https://www.postgresql.org/docs/current/sql-copy.html, > the TEXT format recognizes > backslash-period (\.) as end-of-data marker. > > The example below will raise an error for the line contain

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

2020-09-01 Thread Bruce Momjian
On Tue, Sep 1, 2020 at 12:05:02PM -0400, Bruce Momjian wrote: > > copy test from '/tmp/data' DELIMITER ','; > > > > An end-of-copy marker corrupt error will be raised. > > > > This requires users to escape the end-of-data marker manually in their data. > > Why we don't have a mechanism to define

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

2020-09-01 Thread David G. Johnston
On Tue, Sep 1, 2020 at 9:05 AM Bruce Momjian wrote: > On Tue, Sep 1, 2020 at 06:14:45AM +, Junfeng Yang wrote: > > Hi hackers, > > > > > Data in file "/tmp/data". > > > > 122,as\.d,adad > > 133,sa dad,adadad > > > > Then execute > > > > copy test from '/tmp/data' DELIMITER ','; > > > > An en

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

2020-09-01 Thread Bruce Momjian
On Tue, Sep 1, 2020 at 06:14:45AM +, Junfeng Yang wrote: > Hi hackers, > > As described in the doc https://www.postgresql.org/docs/current/sql-copy.html, > the TEXT format recognizes > backslash-period (\.) as end-of-data marker. > > The example below will raise an error for the line contain