Re: Remaining dependency on setlocale()
| От | Jeff Davis | 
|---|---|
| Тема | Re: Remaining dependency on setlocale() | 
| Дата | |
| Msg-id | 26caf0ee08d9978eba107e2928c3dd164608afb8.camel@j-davis.com обсуждение исходный текст  | 
		
| Ответ на | Re: Remaining dependency on setlocale() ("Daniel Verite" <daniel@manitou-mail.org>) | 
| Ответы | 
                	
            		Re: Remaining dependency on setlocale()
            		
            		 | 
		
| Список | pgsql-hackers | 
On Thu, 2025-10-30 at 21:41 +0100, Daniel Verite wrote:
> What about code in extensions? AFAIU a user can control the
> locale in effect by setting the LC_CTYPE argument of
> CREATE DATABASE, which ends up in the environment
> of backends serving that database.
> If it's forced to "C", how can an extension use locale-aware
> libc functions?
Extensions often need to be updated for a new major version.
The extension should call pg_database_locale(), and pass that to a
function exposed in pg_locale.h. A recent commit exposed pg_iswalpha(),
etc., so there's a reasonable set of functions that should be suitable
for most purposes.
If it's not available in pg_locale.h, or the extension really needs to
use a different LC_CTYPE for some reason, it can use an _l() variant of
the function.
Regards,
    Jeff Davis
		
	В списке pgsql-hackers по дате отправления: