Re: BUG #17501: COPY is failing with "ERROR: invalid byte sequence for encoding "UTF8": 0xe5" - Mailing list pgsql-bugs

From Heikki Linnakangas
Subject Re: BUG #17501: COPY is failing with "ERROR: invalid byte sequence for encoding "UTF8": 0xe5"
Date
Msg-id 196eab40-0754-0fe5-1419-b50459fbb6fc@iki.fi
Whole thread Raw
In response to BUG #17501: COPY is failing with "ERROR: invalid byte sequence for encoding "UTF8": 0xe5"  (PG Bug reporting form <noreply@postgresql.org>)
Responses Re: BUG #17501: COPY is failing with "ERROR: invalid byte sequence for encoding "UTF8": 0xe5"
List pgsql-bugs
On 28/05/2022 23:52, PG Bug reporting form wrote:
> The following bug has been logged on the website:
> 
> Bug reference:      17501
> Logged by:          Vitaly Voronov
> Email address:      wizard_1024@tut.by
> PostgreSQL version: 14.3
> Operating system:   CentOS Linux release 7.9.2009 (Core)
> Description:
> 
> Hello,
> 
> We've seen a such bug: COPY command shows error "ERROR:  invalid byte
> sequence for encoding "UTF8": 0xe5" on file.
> The same file with small amount of lines is imported without any errors.

I was able to reproduce this with your instructions. Thank you!

The bug was indeed introduced by commit f82de5c46b, in v14. Attached 
patch fixes it. Barring any objections, I'll commit and backpatch this.

I also noticed that there are some outdated comments in copyfromparse.c 
that still talk about the old protocol version 2 and COPY_OLD_FE. I'll 
clean that up as a separate commit.

- Heikki
Attachment

pgsql-bugs by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: BUG #17501: COPY is failing with "ERROR: invalid byte sequence for encoding "UTF8": 0xe5"
Next
From: Magnus Hagander
Date:
Subject: Re: BUG #17502: View based on window functions returns wrong results when queried