On Tue, Jan 29, 2013 at 09:54:04AM -0500, Tom Lane wrote:
> Alexander Law <exclusion@gmail.com> writes:
> > Please look at the following l10n bug:
> > http://www.postgresql.org/message-id/502A26F1.6010109@gmail.com
> > and the proposed patch.
>
> That patch looks entirely unsafe to me. Neither of those functions
> should be expected to be able to run when none of our standard
> infrastructure (palloc, elog) is up yet.
>
> Possibly it would be safe to do this somewhere around where we do
> GUC initialization.
Even then, I wouldn't be surprised to find problematic consequences beyond
error display. What if all the databases are EUC_JP, the platform encoding is
KOI8, and some postgresql.conf settings contain EUC_JP characters? Does the
postmaster not rely on its use of SQL_ASCII to allow those values?
I would look at fixing this by making the error output machinery smarter in
this area before changing the postmaster's notion of server_encoding.