Add ENCODING option to COPY - Mailing list pgsql-hackers

From Hitoshi Harada
Subject Add ENCODING option to COPY
Date
Msg-id AANLkTimOy51EVQbL+y0aoNnpu2x02c0OnJQRh=2SP07E@mail.gmail.com
Whole thread Raw
Responses Re: Add ENCODING option to COPY  (Itagaki Takahiro <itagaki.takahiro@gmail.com>)
List pgsql-hackers
Here's the patch to add ENCODING option to COPY command.
The fundamental issue was explained months ago:

http://archives.postgresql.org/message-id/AANLkTikCt6bHXZjO_oX+JS7+G=jAQ7gVZPu0Owjcsbfb@mail.gmail.com

In short, client_encoding is not appropriate for copy operation so we
should need the specialized option for it. Robert Haas agreed with its
need later in the thread. Thanks.

The patch overrides client_encoding by the added ENCODING option, and
restores it as soon as copy is done. I see some complaints ask to use
pg_do_encoding_conversion() instead of
pg_client_to_server/server_to_client(), but the former will surely add
slight overhead per reading line and I believe copy is
performance-sensitive command.

I'll add this to the CF app.

Regards,

--
Hitoshi Harada

Attachment

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Re: [COMMITTERS] pgsql: Exit from base backups when shutdown is requested
Next
From: Simon Riggs
Date:
Subject: Re: Error code for "terminating connection due to conflict with recovery"