Peter Eisentraut <peter_e@gmx.net> writes:
> Am Freitag, 9. Januar 2004 15:51 schrieb Tom Lane:
>> Hmm. So the problem would appear if LC_CTYPE is different from the
>> database encoding? Could we fix it by forcing LC_CTYPE to the database
>> encoding during startup?
> That would resolve quite a few problems, but I don't think there's a way to
> know what encoding a given LC_CTYPE value will result in.
Hmm. Actually it looks like we already do what I had in mind:
ReadControlFile():if (setlocale(LC_CTYPE, ControlFile->lc_ctype) == NULL) ereport(FATAL, ...
So the problem really occurs when database_encoding is set to an
encoding that is incompatible with the one implied by the initdb-time
LC_CTYPE ... which we have no good way to check. Ugh.
I have some vague recollection that glibc offers an API extension that
allows this to be checked. Is it worth having a solution that catches
the problem on glibc only?
regards, tom lane