Skip site navigation (1) Skip section navigation (2)

Fix for pg_upgrade's forcing pg_controldata into English

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Greg Sabino Mullane <greg(at)turnstep(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Fix for pg_upgrade's forcing pg_controldata into English
Date: 2010-09-01 20:35:18
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
Tom Lane wrote:
> Bruce Momjian <bruce(at)momjian(dot)us> writes:
> > Greg Sabino Mullane wrote:
> >> Specifically, LANGUAGE changes the headers of pg_controldata 
> >> (but not the actual output, LC_ALL does that). Thanks for the 
> >> nudge, I'll get to rewriting some code.
> > pg_upgrade does this in controldata.c for this exact reason:
> > 	    /*
> > 	     * Because we test the pg_resetxlog output strings, it has to be in
> > 	     * English.
> > 	     */
> > 	    if (getenv("LANG"))
> > 	        lang = pg_strdup(ctx, getenv("LANG"));
> > 	#ifndef WIN32
> > 	    putenv(pg_strdup(ctx, "LANG=C"));
> > 	#else
> > 	    SetEnvironmentVariableA("LANG", "C");
> > 	#endif
> You do realize that's far from bulletproof?  To be sure that that does
> anything, you'd need to set (or unset) LC_ALL and LC_MESSAGES as well.
> And I thought Windows spelled it LANGUAGE not LANG ...

I have implemented your suggestion of setting LANG, LANGUAGE, and
LC_MESSAGES based on code in pg_regress.c;  that is the only place I see
where we force English, and it certainly has received more testing.

Should I set LC_ALL too?  The other variables mentioned in pg_regress.c?
Is this something I should patch to 9.0.X?

Patch attached.

  Bruce Momjian  <bruce(at)momjian(dot)us>

  + It's impossible for everything to be true. +

Attachment: /pgpatches/pg_upgrade
Description: text/x-diff (3.7 KB)


pgsql-hackers by date

Next:From: Simon RiggsDate: 2010-09-01 20:43:01
Subject: Re: Synchronous replication - patch status inquiry
Previous:From: Tom LaneDate: 2010-09-01 19:31:33
Subject: Re: compiling with RELCACHE_FORCE_RELEASE doesn't pass regression

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group