Re: Add ENCODING option to COPY - Mailing list pgsql-hackers

From Itagaki Takahiro
Subject Re: Add ENCODING option to COPY
Date
Msg-id AANLkTi=kU9k6Yk6ZPvAXjiWsmYATQ6n10-63XZLZbLZ4@mail.gmail.com
Whole thread Raw
In response to Add ENCODING option to COPY  (Hitoshi Harada <umi.tanuki@gmail.com>)
Responses Re: Add ENCODING option to COPY  (Hitoshi Harada <umi.tanuki@gmail.com>)
List pgsql-hackers
On Sat, Jan 15, 2011 at 02:25, Hitoshi Harada <umi.tanuki@gmail.com> wrote:
> The patch overrides client_encoding by the added ENCODING option, and
> restores it as soon as copy is done.

We cannot do that because error messages should be encoded in the original
encoding even during COPY commands with encoding option. Error messages
could contain non-ASCII characters if lc_messages is set.

> 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

If we want to reduce the overhead, we should cache the conversion procedure
in CopyState. How about adding something like "FmgrInfo file_to_server_covv"
into it?

-- 
Itagaki Takahiro


pgsql-hackers by date:

Previous
From: Josh Berkus
Date:
Subject: Re: Seeking Mentors for Funded Reviewers
Next
From: Richard Broersma
Date:
Subject: Re: Seeking Mentors for Funded Reviewers