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

From Tom Lane
Subject Re: Add ENCODING option to COPY
Date
Msg-id 17784.1296491138@sss.pgh.pa.us
Whole thread Raw
In response to Re: 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
Hitoshi Harada <umi.tanuki@gmail.com> writes:
> Finally I concluded the concern Itagaki-san raised can be solved by
> adding code that restores client_encoding in copy_in_error_callback.

That seems like an absolutely horrid idea.  Error context callbacks
should not have side-effects like that.  They're not guaranteed to be
called at all, let alone in any particular order.  In this case I'd also
be worried that the state needs to be fixed before elog.c reaches the
point of calling the callbacks --- there's nothing to say that it might
not try to translate some strings to the client encoding earlier than
that.

It might happen to work today (or at least in the scenarios you tested),
but it seems fragile as can be.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Error code for "terminating connection due to conflict with recovery"
Next
From: Heikki Linnakangas
Date:
Subject: Re: Allowing multiple concurrent base backups