where is the locale set for each server instance?

Started by Palle Girgensohnabout 21 years ago5 messagesgeneral
Jump to latest
#1Palle Girgensohn
girgen@pingpong.net

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

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Palle Girgensohn (#1)
Re: where is the locale set for each server instance?

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

#3Palle Girgensohn
girgen@pingpong.net
In reply to: Tom Lane (#2)
Re: where is the locale set for each server instance?

--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

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Palle Girgensohn (#3)
Re: where is the locale set for each server instance?

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

#5Palle Girgensohn
girgen@pingpong.net
In reply to: Tom Lane (#4)
Re: where is the locale set for each server instance?

--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