Re: Relocatable locale - Mailing list pgsql-patches

From Bruce Momjian
Subject Re: Relocatable locale
Date
Msg-id 200405250141.i4P1fkg29764@candle.pha.pa.us
Whole thread Raw
In response to Re: Relocatable locale  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Relocatable locale  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-patches
Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > I have two questions.  First, setlocale() seemed to be inconsistently
> > set inside and outside of ENABLE_NLS.  I assume the proper location is
> > inside.
>
> Please do *not* go adding setlocale calls that were not there before.
> You *will* break things.
>
> > !         setlocale(LC_ALL, "");
>             ^^^^^^^^^^^^^^^^^^^^^
>
> Putting this call in the backend is a very serious mistake.  It might be
> okay in clients, but not in the backend.

OK, patch applied.  Turns out it was only added for the backend
("postgres").

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
Index: src/port/path.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/port/path.c,v
retrieving revision 1.12
diff -c -c -r1.12 path.c
*** src/port/path.c    25 May 2004 01:00:30 -0000    1.12
--- src/port/path.c    25 May 2004 01:40:36 -0000
***************
*** 251,257 ****
      char path[MAXPGPATH];
      char my_exec_path[MAXPGPATH];

!     setlocale(LC_ALL, "");
      if (find_my_exec(argv0, my_exec_path) < 0)
          return;

--- 251,260 ----
      char path[MAXPGPATH];
      char my_exec_path[MAXPGPATH];

!     /* don't set LC_ALL in the backend */
!     if (strcmp(app, "postgres") != 0)
!         setlocale(LC_ALL, "");
!
      if (find_my_exec(argv0, my_exec_path) < 0)
          return;


pgsql-patches by date:

Previous
From: Tom Lane
Date:
Subject: Re: Relocatable locale
Next
From: Tom Lane
Date:
Subject: Re: Relocatable locale