Add ENCODING option to COPY

From: Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Add ENCODING option to COPY
Date: 2011-01-14 17:25:28
Message-ID: AANLkTimOy51EVQbL+y0aoNnpu2x02c0OnJQRh=2SP07E@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
copy_encoding.patch application/octet-stream 7.7 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2011-01-14 17:29:25 Re: Error code for "terminating connection due to conflict with recovery"
Previous Message Tom Lane 2011-01-14 17:22:30 Re: Re: [COMMITTERS] pgsql: Exit from base backups when shutdown is requested