Re: Bug in COPY FROM backslash escaping multi-byte chars - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: Bug in COPY FROM backslash escaping multi-byte chars
Date
Msg-id fb716ba3-b3e4-8d6c-cbfd-283be980ae42@iki.fi
Whole thread Raw
In response to Re: Bug in COPY FROM backslash escaping multi-byte chars  (John Naylor <john.naylor@enterprisedb.com>)
Responses Re: Bug in COPY FROM backslash escaping multi-byte chars
List pgsql-hackers
On 03/02/2021 15:38, John Naylor wrote:
> On Wed, Feb 3, 2021 at 8:08 AM Heikki Linnakangas <hlinnaka@iki.fi 
> <mailto:hlinnaka@iki.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



pgsql-hackers by date:

Previous
From: John Naylor
Date:
Subject: Re: Bug in COPY FROM backslash escaping multi-byte chars
Next
From: Alvaro Herrera
Date:
Subject: Re: libpq debug log