diff -rpcd a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c *** a/src/backend/postmaster/postmaster.c 2013-12-02 09:17:05.000000000 +0900 --- b/src/backend/postmaster/postmaster.c 2013-12-13 16:14:51.000000000 +0900 *************** BackendInitialize(Port *port) *** 3970,3975 **** --- 3970,3980 ---- enable_timeout_after(STARTUP_PACKET_TIMEOUT, AuthenticationTimeout * 1000); /* + * Output messages in English because client encoding is not known yet. + */ + disable_message_localization(); + + /* * Receive the startup packet (which might turn out to be a cancel request * packet). */ diff -rpcd a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c *** a/src/backend/utils/error/elog.c 2013-12-02 09:17:05.000000000 +0900 --- b/src/backend/utils/error/elog.c 2013-12-13 16:15:00.000000000 +0900 *************** static int errordata_stack_depth = -1; / *** 147,152 **** --- 147,154 ---- static int recursion_depth = 0; /* to detect actual recursion */ + static bool localize_message = true; + /* buffers for formatted timestamps that might be used by both * log_line_prefix and csv logs. */ *************** in_error_recursion_trouble(void) *** 197,202 **** --- 199,216 ---- return (recursion_depth > 2); } + void + enable_message_localization(void) + { + localize_message = true; + } + + void + disable_message_localization(void) + { + localize_message = false; + } + /* * One of those fallback steps is to stop trying to localize the error * message, since there's a significant probability that that's exactly *************** static inline const char * *** 206,212 **** err_gettext(const char *str) { #ifdef ENABLE_NLS ! if (in_error_recursion_trouble()) return str; else return gettext(str); --- 220,226 ---- err_gettext(const char *str) { #ifdef ENABLE_NLS ! if (!localize_message || in_error_recursion_trouble()) return str; else return gettext(str); *************** errcode_for_socket_access(void) *** 703,709 **** char *fmtbuf; \ StringInfoData buf; \ /* Internationalize the error format string */ \ ! if (translateit && !in_error_recursion_trouble()) \ fmt = dgettext((domain), fmt); \ /* Expand %m in format string */ \ fmtbuf = expand_fmt_string(fmt, edata); \ --- 717,723 ---- char *fmtbuf; \ StringInfoData buf; \ /* Internationalize the error format string */ \ ! if (translateit && localize_message && !in_error_recursion_trouble()) \ fmt = dgettext((domain), fmt); \ /* Expand %m in format string */ \ fmtbuf = expand_fmt_string(fmt, edata); \ *************** errcode_for_socket_access(void) *** 744,750 **** char *fmtbuf; \ StringInfoData buf; \ /* Internationalize the error format string */ \ ! if (!in_error_recursion_trouble()) \ fmt = dngettext((domain), fmt_singular, fmt_plural, n); \ else \ fmt = (n == 1 ? fmt_singular : fmt_plural); \ --- 758,764 ---- char *fmtbuf; \ StringInfoData buf; \ /* Internationalize the error format string */ \ ! if (localize_message && !in_error_recursion_trouble()) \ fmt = dngettext((domain), fmt_singular, fmt_plural, n); \ else \ fmt = (n == 1 ? fmt_singular : fmt_plural); \ diff -rpcd a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c *** a/src/backend/utils/init/postinit.c 2013-12-02 09:17:05.000000000 +0900 --- b/src/backend/utils/init/postinit.c 2013-12-13 16:15:10.000000000 +0900 *************** InitPostgres(const char *in_dbname, Oid *** 737,742 **** --- 737,745 ---- /* initialize client encoding */ InitializeClientEncoding(); + /* now that client encoding is known, localize later messages */ + enable_message_localization(); + /* report this backend in the PgBackendStatus array */ pgstat_bestart(); *************** InitPostgres(const char *in_dbname, Oid *** 914,919 **** --- 917,925 ---- /* initialize client encoding */ InitializeClientEncoding(); + /* now that client encoding is known, localize later messages */ + enable_message_localization(); + /* report this backend in the PgBackendStatus array */ if (!bootstrap) pgstat_bestart(); diff -rpcd a/src/include/utils/elog.h b/src/include/utils/elog.h *** a/src/include/utils/elog.h 2013-12-02 09:17:04.000000000 +0900 --- b/src/include/utils/elog.h 2013-12-13 16:14:29.000000000 +0900 *************** extern char *Log_destination_string; *** 440,445 **** --- 440,447 ---- extern void DebugFileOpen(void); extern char *unpack_sql_state(int sql_state); extern bool in_error_recursion_trouble(void); + extern void enable_message_localization(void); + extern void disable_message_localization(void); #ifdef HAVE_SYSLOG extern void set_syslog_parameters(const char *ident, int facility);