Re: [bug fix] strerror() returns ??? in a UTF-8/C database with LC_MESSAGES=non-ASCII

From: "MauMau" <maumau307(at)gmail(dot)com>
To: "Greg Stark" <stark(at)mit(dot)edu>
Cc: "Peter Eisentraut" <peter_e(at)gmx(dot)net>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Noah Misch" <noah(at)leadboat(dot)com>, "PostgreSQL-development" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [bug fix] strerror() returns ??? in a UTF-8/C database with LC_MESSAGES=non-ASCII
Date: 2013-09-10 12:47:07
Message-ID: 75B586D4B6684564BA4D69BC938FAE3E@maumau
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

From: "Greg Stark" <stark(at)mit(dot)edu>
> Wait, why does the ctype of the database affect the ctype of the
> messages? Shouldn't these be two separate things? One describes the
> character set being used to store data in the database and the other
> the character set the log file and clients are in.

At session start, PostgreSQL sets the ctype of the database to be the
process's LC_CTYPE locale category in src/backend/utils/init/postinit.c:

ctype = NameStr(dbform->datctype);
...
if (pg_perm_setlocale(LC_CTYPE, ctype) == NULL)

The LC_CTYPE locale category determines the character encoding for messages
obtained by gettext(). This is gettext()'s specification.

Regards
MauMau

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2013-09-10 13:48:21 Re: New statistics for WAL buffer dirty writes
Previous Message Robert Haas 2013-09-10 12:45:14 Re: strange IS NULL behaviour