Re: Bug in COPY FROM backslash escaping multi-byte chars

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: John Naylor <john(dot)naylor(at)enterprisedb(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Bug in COPY FROM backslash escaping multi-byte chars
Date: 2021-02-03 13:46:30
Message-ID: fb716ba3-b3e4-8d6c-cbfd-283be980ae42@iki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 03/02/2021 15:38, John Naylor wrote:
> On Wed, Feb 3, 2021 at 8:08 AM Heikki Linnakangas <hlinnaka(at)iki(dot)fi
> <mailto:hlinnaka(at)iki(dot)fi>> wrote:
> >
> > Hi,
> >
> > While playing with COPY FROM refactorings in another thread, I noticed
> > corner case where I think backslash escaping doesn't work correctly.
> > Consider the following input:
> >
> > \么.foo
>
> I've seen multibyte delimiters in the wild, so it's not as outlandish as
> it seems.

We don't actually support multi-byte characters as delimiters or quote
or escape characters:

postgres=# copy copytest from 'foo' with (delimiter '么');
ERROR: COPY delimiter must be a single one-byte character

> The fix is simple enough, so +1.

Thanks, I'll commit and backpatch shortly.

- Heikki

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2021-02-03 13:58:59 Re: libpq debug log
Previous Message John Naylor 2021-02-03 13:38:11 Re: Bug in COPY FROM backslash escaping multi-byte chars