Re: confusing / inefficient "need_transcoding" handling in copy - Mailing list pgsql-hackers

From Tom Lane
Subject Re: confusing / inefficient "need_transcoding" handling in copy
Date
Msg-id 526893.1707241908@sss.pgh.pa.us
Whole thread Raw
In response to Re: confusing / inefficient "need_transcoding" handling in copy  (Michael Paquier <michael@paquier.xyz>)
Responses Re: confusing / inefficient "need_transcoding" handling in copy
List pgsql-hackers
Michael Paquier <michael@paquier.xyz> writes:
> On Mon, Feb 05, 2024 at 06:05:04PM -0800, Andres Freund wrote:
>> I haven't yet dug into the code history. One guess is that this should only
>> have been set this way for COPY FROM.

> Looking the git history, this looks like an oversight of c61a2f58418e
> that has added the condition on pg_database_encoding_max_length(), no?
> Adding Tom and Ishii-san, even if this comes from 2005.

Yeah, back in 8.1 that code was applied for both directions, but
probably it should have enforced validation for same-encoding
cases only for COPY FROM.

It looks like now we have a mess, because the condition was copied
verbatim into copyto.c but not copyfrom.c.  Aren't we failing to
validate encoding in this case in COPY FROM, which is where we
actually need to?

            regards, tom lane



pgsql-hackers by date:

Previous
From: Bharath Rupireddy
Date:
Subject: Re: Introduce XID age and inactive timeout based replication slot invalidation
Next
From: "Amonson, Paul D"
Date:
Subject: RE: Popcount optimization using AVX512