Add ENCODING option to COPY
Hitoshi Harada <umi.tanuki@gmail.com>
From: Hitoshi Harada <umi.tanuki@gmail.com>
To: PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2011-01-14T17:25:28Z
Lists: pgsql-hackers
Attachments
- copy_encoding.patch (application/octet-stream) patch
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