pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruce Momjian <bruce@momjian.us>
To: 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, 1 Sep 2020 13:23:00 -0400
Message-ID: <20200901172300.GX13613@momjian.us> (raw)
In-Reply-To: <20200901160502.GW13613@momjian.us>
References: <DM5PR0501MB3880CB81067E14F9C78FA28BCC2E0@DM5PR0501MB3880.namprd05.prod.outlook.com>
	<20200901160502.GW13613@momjian.us>

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 other characters as end-of-data marker?
> > Or there are other ways to avoid escape the end-of-data in data?
> 
> This is the first I am hearing of this.  The problem is that the system
> can't decide if \. is escaping a delimiter, or the end-of-copy marker. 
> I think we need to just disable period as a delimiter.  I don't think
> there is enough demand to allow the end-of-data marker to be
> configurable.
> 
> Interestingly, you can use period as s delimiter if you are copying from
> a file that doesn't need an end-of-data marker and you never need to
> escape the delimiter, but that seems like too rare a use case to allow
> period to be supported as a delimiter.

I am sorry I mis-read this email.  The example uses _comma_ for the
delimiter, rather than period.  Let me reply again.  We already disallow
period for delimiters:

        COPY test TO '/u/postgres/tmp/x' WITH (DELIMITER '.');
        ERROR:  COPY delimiter cannot be "."

        COPY test TO STDOUT WITH (DELIMITER '.');
        ERROR:  COPY delimiter cannot be "."

-- 
  Bruce Momjian  <bruce@momjian.us>        https://momjian.us
  EnterpriseDB                             https://enterprisedb.com

  The usefulness of a cup is in its emptiness, Bruce Lee






view thread (8+ messages)  latest in thread

Message-ID: <20200901172300.GX13613@momjian.us>
Permalink:  ../20200901172300.GX13613@momjian.us/
Also on:    postgresql.org/message-id/20200901172300.GX13613@momjian.us

 · 

reply

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: 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: <20200901172300.GX13613@momjian.us>
  References: <DM5PR0501MB3880CB81067E14F9C78FA28BCC2E0@DM5PR0501MB3880.namprd05.prod.outlook.com> <20200901160502.GW13613@momjian.us> <20200901172300.GX13613@momjian.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