Thread: where is the locale set for each server instance?
Hi! I'm pluggin ICU into PostgreSQL for unicode collation, since FreeBSD has no support for unicode collation. It works fine, but I cannot find out where to set the default locale for each backend instance. I want to use the LC_COLLATE used in initdb, now I've just hard wired it for my own needs. I tried backend/access/transam/xlog.c:ReadControlFile, but it is not sufficient. in backend/main/main.c: /* * Set up locale information from environment. Note that LC_CTYPE and * LC_COLLATE will be overridden later from pg_control if we are in an * already-initialized database. So, I'm trying to find out where LC_COLLATE is overridden. Any tips? Thanks, Palle
Palle Girgensohn <girgen@pingpong.net> writes: > So, I'm trying to find out where LC_COLLATE is overridden. Any tips? access/transam/xlog.c (which is the only file that touches pg_control, I believe). regards, tom lane
--On söndag, mars 13, 2005 17.01.31 -0500 Tom Lane <tgl@sss.pgh.pa.us> wrote: > Palle Girgensohn <girgen@pingpong.net> writes: >> So, I'm trying to find out where LC_COLLATE is overridden. Any tips? > > access/transam/xlog.c (which is the only file that touches pg_control, > I believe). OK, seems my problem is with ICU. The xlog.c:ReadConfigFile() is not run for each backend, it seems, I assume it is forked after that. Seems ICU cannot "remember" a setDefault(locale) call for some reason. I'll just have to do a setlocale(LC_COLLATE, NULL) when I need one, I guess... It'll work fine. Thanks! Palle
Palle Girgensohn <girgen@pingpong.net> writes: > OK, seems my problem is with ICU. The xlog.c:ReadConfigFile() is not run > for each backend, it seems, I assume it is forked after that. No, it is run once in the postmaster, as indeed the comments in it say. > Seems ICU > cannot "remember" a setDefault(locale) call for some reason. Curious. You'd expect whatever state that sets to persist across a fork. You should probably ping the ICU people about it. regards, tom lane
--On söndag, mars 13, 2005 18.37.24 -0500 Tom Lane <tgl@sss.pgh.pa.us> wrote: > Palle Girgensohn <girgen@pingpong.net> writes: >> OK, seems my problem is with ICU. The xlog.c:ReadConfigFile() is not run >> for each backend, it seems, I assume it is forked after that. > > No, it is run once in the postmaster, as indeed the comments in it say. > >> Seems ICU >> cannot "remember" a setDefault(locale) call for some reason. > > Curious. You'd expect whatever state that sets to persist across a fork. > You should probably ping the ICU people about it. You're right, I will. Thanks, Palle