Re: confusing / inefficient "need_transcoding" handling in copy

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Sutou Kouhei <kou@clear-code.com>
Cc: andres@anarazel.de, tgl@sss.pgh.pa.us, pgsql-hackers@postgresql.org, ishii@sraoss.co.jp
Date: 2024-12-14T07:46:57Z
Lists: pgsql-hackers
On Fri, Dec 13, 2024 at 12:27:37PM +0900, Sutou Kouhei wrote:
> Oh, sorry... I attached wrong patch...
> I attach the v4 patch that includes this case.

Sounds fair to me as a beginning for the code paths setting
need_transcoding.

Note that using "test" as table name for the tests is not a good idea,
as this could very likely conflict with some concurrent activity.  I
would also add two RESET queries to remove the dependency to
client_encoding once the test has no need to rely on it.  No need to
send a new patch for all that, just noticing in passing.
--
Michael

Commits

  1. Add some tests for encoding conversion in COPY TO/FROM

  2. Improve COPY TO performance when server and client encodings match